Autoload Exif and move global defines to Exif:: namespace
[mediawiki.git] / maintenance / parserTests.txt
blob72ee3ed2598985cbc1858c494820daf62f561eae
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
161 ### Comments
163 !! test
164 Comment test 1
165 !! input
166 <!-- comment 1 --> asdf
167 <!-- comment 2 -->
168 !! result
169 <pre>asdf
170 </pre>
172 !! end
174 !! test
175 Comment test 2
176 !! input
177 asdf
178 <!-- comment 1 -->
180 !! result
181 <p>asdf
183 </p>
184 !! end
186 !! test
187 Comment test 3
188 !! input
189 asdf
190 <!-- comment 1 -->
191 <!-- comment 2 -->
193 !! result
194 <p>asdf
196 </p>
197 !! end
199 !! test
200 Comment test 4
201 !! input
202 asdf<!-- comment 1 -->jkl
203 !! result
204 <p>asdfjkl
205 </p>
206 !! end
208 !! test
209 Comment spacing
210 !! input
212  <!-- foo --> b <!-- bar -->
214 !! result
215 <p>a
216 </p>
217 <pre> b 
218 </pre>
219 <p>c
220 </p>
221 !! end
223 !! test
224 Comment whitespace
225 !! input
226 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
227 !! result
229 !! end
231 !! test
232 Comment semantics and delimiters
233 !! input
234 <!-- --><!----><!-----><!------>
235 !! result
237 !! end
239 !! test
240 Comment semantics and delimiters, redux
241 !! input
242 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
243 -- foo -- funky huh? ... -->
244 !! result
246 !! end
248 !! test
249 Comment semantics and delimiters: directors cut
250 !! input
251 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
252 everything starting with < followed by !-- until the first -- and > we see,
253 that wouldn't be valid XML however, since in XML -- has to terminate a comment
254 -->-->
255 !! result
256 <p>-->
257 </p>
258 !! end
260 !! test
261 Comment semantics: nesting
262 !! input
263 <!--<!-- no, we're not going to do anything fancy here -->-->
264 !! result
265 <p>-->
266 </p>
267 !! end
269 !! test
270 Comment semantics: unclosed comment at end
271 !! input
272 <!--This comment will run out to the end of the document
273 !! result
275 !! end
279 ### Preformatted text
281 !! test
282 Preformatted text
283 !! input
284  This is some
285  Preformatted text
286  With ''italic''
287  And '''bold'''
288  And a [[Main Page|link]]
289 !! result
290 <pre>This is some
291 Preformatted text
292 With <i>italic</i>
293 And <b>bold</b>
294 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
295 </pre>
296 !! end
298 !! test
299 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
300 !! input
301 <pre><nowiki>
303 <cite>
304 <em>
305 </nowiki></pre>
306 !! result
307 <pre>
308 &lt;b&gt;
309 &lt;cite&gt;
310 &lt;em&gt;
311 </pre>
313 !! end
316 ### Definition lists
318 !! test
319 Simple definition
320 !! input
321 ; name : Definition
322 !! result
323 <dl><dt> name&nbsp;</dt><dd> Definition
324 </dd></dl>
326 !! end
328 !! test
329 Simple definition
330 !! input
331 : Indented text
332 !! result
333 <dl><dd> Indented text
334 </dd></dl>
336 !! end
338 !! test
339 Definition list with no space
340 !! input
341 ;name:Definition
342 !! result
343 <dl><dt>name</dt><dd>Definition
344 </dd></dl>
346 !!end
348 !! test
349 Definition list with URL link
350 !! input
351 ; http://example.com/ : definition
352 !! result
353 <dl><dt> <a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
354 </dd></dl>
356 !! end
358 !! test
359 Definition list with bracketed URL link
360 !! input
361 ;[http://www.example.com/ Example]:Something about it
362 !! result
363 <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
364 </dd></dl>
366 !! end
368 !! test
369 Definition list with wikilink containing colon
370 !! input
371 ; [[Help:FAQ]]: The least-read page on Wikipedia
372 !! result
373 <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
374 </dd></dl>
376 !! end
378 # At Brion's and JeLuF's insistence... :)
379 !! test
380 Definition list with wikilink containing colon
381 !! input
382 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
383 !! result
384 <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!
385 </dd></dl>
387 !! end
389 !! test
390 Malformed definition list with colon
391 !! input
392 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
393 !! result
394 <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
395 </dt></dl>
397 !! end
399 !! test
400 Definition lists: colon in external link text
401 !! input
402 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
403 !! result
404 <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
405 </dd></dl>
407 !! end
409 !! test
410 Definition lists: colon in HTML attribute
411 !! input
412 ;<b style="display: inline">bold</b>
413 !! result
414 <dl><dt><b style="display: inline">bold</b>
415 </dt></dl>
417 !! end
420 !! test
421 Definition lists: self-closed tag
422 !! input
423 ;one<br/>two : two-line fun
424 !! result
425 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
426 </dd></dl>
428 !! end
432 ### External links
434 !! test
435 External links: non-bracketed
436 !! input
437 Non-bracketed: http://example.com
438 !! result
439 <p>Non-bracketed: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
440 </p>
441 !! end
443 !! test
444 External links: numbered
445 !! input
446 Numbered: [http://example.com]
447 Numbered: [http://example.net]
448 Numbered: [http://example.org]
449 !! result
450 <p>Numbered: <a href="http://example.com" class='external autonumber' title="http://example.com" rel="nofollow">[1]</a>
451 Numbered: <a href="http://example.net" class='external autonumber' title="http://example.net" rel="nofollow">[2]</a>
452 Numbered: <a href="http://example.org" class='external autonumber' title="http://example.org" rel="nofollow">[3]</a>
453 </p>
454 !!end
456 !! test
457 External links: specified text
458 !! input
459 Specified text: [http://example.com link]
460 !! result
461 <p>Specified text: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>
462 </p>
463 !!end
465 !! test
466 External links: trail
467 !! input
468 Linktrails should not work for external links: [http://example.com link]s
469 !! result
470 <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
471 </p>
472 !! end
474 !! test
475 External links: dollar sign in URL
476 !! input
477 http://example.com/1$2345
478 !! result
479 <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>
480 </p>
481 !! end
483 !! test
484 External links: dollar sign in URL (named)
485 !! input
486 [http://example.com/1$2345]
487 !! result
488 <p><a href="http://example.com/1$2345" class='external autonumber' title="http://example.com/1$2345" rel="nofollow">[1]</a>
489 </p>
490 !!end
492 !! test
493 External links: open square bracket forbidden in URL (bug 4377)
494 !! input
495 http://example.com/1[2345
496 !! result
497 <p><a href="http://example.com/1" class='external free' title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
498 </p>
499 !! end
501 !! test
502 External links: open square bracket forbidden in URL (named) (bug 4377)
503 !! input
504 [http://example.com/1[2345]
505 !! result
506 <p><a href="http://example.com/1" class='external text' title="http://example.com/1" rel="nofollow">[2345</a>
507 </p>
508 !!end
510 !! test
511 External image
512 !! input
513 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
514 !! result
515 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
516 </p>
517 !! end
519 !! test
520 External image from https
521 !! input
522 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
523 !! result
524 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
525 </p>
526 !! end
528 !! test
529 Link to non-http image, no img tag
530 !! input
531 Link to non-http image, no img tag: ftp://example.com/test.jpg
532 !! result
533 <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>
534 </p>
535 !! end
537 !! test
538 External links: terminating separator
539 !! input
540 Terminating separator: http://example.com/thing,
541 !! result
542 <p>Terminating separator: <a href="http://example.com/thing" class='external free' title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
543 </p>
544 !! end
546 !! test
547 External links: intervening separator
548 !! input
549 Intervening separator: http://example.com/1,2,3
550 !! result
551 <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>
552 </p>
553 !! end
555 !! test
556 External links: old bug with URL in query
557 !! input
558 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
559 !! result
560 <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>
561 </p>
562 !! end
564 !! test
565 External links: old URL-in-URL bug, mixed protocols
566 !! input
567 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
568 !! result
569 <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>
570 </p>
571 !!end
573 !! test
574 External links: URL in text
575 !! input
576 URL in text: [http://example.com http://example.com]
577 !! result
578 <p>URL in text: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
579 </p>
580 !! end
582 !! test
583 External links: Clickable images
584 !! input
585 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
586 !! result
587 <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>
588 </p>
589 !!end
591 !! test
592 External links: raw ampersand
593 !! input
594 Old &amp; use: http://x&y
595 !! result
596 <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>
597 </p>
598 !! end
600 !! test
601 External links: encoded ampersand
602 !! input
603 Old &amp; use: http://x&amp;y
604 !! result
605 <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>
606 </p>
607 !! end
609 !! test
610 External links: encoded equals (bug 6102)
611 !! input
612 http://example.com/?foo&#61;bar
613 !! result
614 <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>
615 </p>
616 !! end
618 !! test
619 External links: [raw ampersand]
620 !! input
621 Old &amp; use: [http://x&y]
622 !! result
623 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
624 </p>
625 !! end
627 !! test
628 External links: [encoded ampersand]
629 !! input
630 Old &amp; use: [http://x&amp;y]
631 !! result
632 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
633 </p>
634 !! end
636 !! test
637 External links: [encoded equals] (bug 6102)
638 !! input
639 [http://example.com/?foo&#61;bar]
640 !! result
641 <p><a href="http://example.com/?foo=bar" class='external autonumber' title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
642 </p>
643 !! end
645 !! test
646 External links: www.jpeg.org (bug 554)
647 !! input
648 http://www.jpeg.org
649 !!result
650 <p><a href="http://www.jpeg.org" class='external free' title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
651 </p>
652 !! end
654 !! test
655 External links: URL within URL (original bug 2)
656 !! input
657 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
658 !! result
659 <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>
660 </p>
661 !! end
663 !! test
664 BUG 361: URL inside bracketed URL
665 !! input
666 [http://www.example.com/foo http://www.example.com/bar]
667 !! result
668 <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>
669 </p>
670 !! end
672 !! test
673 BUG 361: URL within URL, not bracketed
674 !! input
675 http://www.example.com/foo?=http://www.example.com/bar
676 !! result
677 <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>
678 </p>
679 !! end
681 !! test
682 BUG 289: ">"-token in URL-tail
683 !! input
684 http://www.example.com/<hello>
685 !! result
686 <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;
687 </p>
688 !!end
690 !! test
691 BUG 289: literal ">"-token in URL-tail
692 !! input
693 http://www.example.com/<b>html</b>
694 !! result
695 <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>
696 </p>
697 !!end
699 !! test
700 BUG 289: ">"-token in bracketed URL
701 !! input
702 [http://www.example.com/<hello> stuff]
703 !! result
704 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
705 </p>
706 !!end
708 !! test
709 BUG 289: literal ">"-token in bracketed URL
710 !! input
711 [http://www.example.com/<b>html</b> stuff]
712 !! result
713 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
714 </p>
715 !!end
717 !! test
718 BUG 289: literal double quote at end of URL
719 !! input
720 http://www.example.com/"hello"
721 !! result
722 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
723 </p>
724 !!end
726 !! test
727 BUG 289: literal double quote in bracketed URL
728 !! input
729 [http://www.example.com/"hello" stuff]
730 !! result
731 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
732 </p>
733 !!end
735 !! test
736 External links: invalid character
737 Fixme: the missing char seems to have gone missing
738 !! options
739 disabled
740 !! input
741 [http://www.example.com  test]
742 !! result
743 <p>[<a href="http://www.example.com" class='external free' title="http://www.example.com" rel="nofollow">http://www.example.com</a>  test]
744 </p>
745 !! end
747 !! test
748 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
749 !! input
750 [http://www.example.com  test]
751 !! result
752 <p><a href="http://www.example.com" class='external text' title="http://www.example.com" rel="nofollow">test</a>
753 </p>
754 !! end
756 !! test
757 External links: wiki links within external link (Bug 3695)
758 !! input
759 [http://example.com [[wikilink]] embedded in ext link]
760 !! result
761 <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>
762 </p>
763 !! end
765 !! test
766 BUG 787: Links with one slash after the url protocol are invalid
767 !! input
768 http:/example.com
770 [http:/example.com title]
771 !! result
772 <p>http:/example.com
773 </p><p>[http:/example.com title]
774 </p>
775 !! end
777 !! test
778 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
779 !! input
780 ''[http://example.com text'']
781 [http://example.com '''text]'''
782 ''Something [http://example.com in italic'']
783 ''Something [http://example.com mixed''''', even bold]'''
784 '''''Now [http://example.com both''''']
785 !! result
786 <p><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>text</i></a>
787 <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><b>text</b></a>
788 <i>Something </i><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>in italic</i></a>
789 <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>
790 <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>
791 </p>
792 !! end
795 !! test
796 Bug 4781: %26 in URL
797 !! input
798 http://www.example.com/?title=AT%26T
799 !! result
800 <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>
801 </p>
802 !! end
804 !! test
805 Bug 4781, 5267: %26 in URL
806 !! input
807 http://www.example.com/?title=100%25_Bran
808 !! result
809 <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>
810 </p>
811 !! end
813 !! test
814 Bug 4781, 5267: %28, %29 in URL
815 !! input
816 http://www.example.com/?title=Ben-Hur_%281959_film%29
817 !! result
818 <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>
819 </p>
820 !! end
823 !! test
824 Bug 4781: %26 in autonumber URL
825 !! input
826 [http://www.example.com/?title=AT%26T]
827 !! result
828 <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>
829 </p>
830 !! end
832 !! test
833 Bug 4781, 5267: %26 in autonumber URL
834 !! input
835 [http://www.example.com/?title=100%25_Bran]
836 !! result
837 <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>
838 </p>
839 !! end
841 !! test
842 Bug 4781, 5267: %28, %29 in autonumber URL
843 !! input
844 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
845 !! result
846 <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>
847 </p>
848 !! end
851 !! test
852 Bug 4781: %26 in bracketed URL
853 !! input
854 [http://www.example.com/?title=AT%26T link]
855 !! result
856 <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>
857 </p>
858 !! end
860 !! test
861 Bug 4781, 5267: %26 in bracketed URL
862 !! input
863 [http://www.example.com/?title=100%25_Bran link]
864 !! result
865 <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>
866 </p>
867 !! end
869 !! test
870 Bug 4781, 5267: %28, %29 in bracketed URL
871 !! input
872 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
873 !! result
874 <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>
875 </p>
876 !! end
878 !! test
879 External link containing double-single-quotes in text '' (bug 4598 sanity check)
880 !! input
881 Some [http://example.com/ pretty ''italics'' and stuff]!
882 !! result
883 <p>Some <a href="http://example.com/" class='external text' title="http://example.com/" rel="nofollow">pretty <i>italics</i> and stuff</a>!
884 </p>
885 !! end
887 !! test
888 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
889 !! input
890 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
891 !! result
892 <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>
893 </p>
894 !! end
899 ### Quotes
902 !! test
903 Quotes
904 !! input
905 Normal text. '''Bold text.''' Normal text. ''Italic text.''
907 Normal text. '''''Bold italic text.''''' Normal text.
908 !!result
909 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
910 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
911 </p>
912 !! end
915 !! test
916 Unclosed and unmatched quotes
917 !! input
918 '''''Bold italic text '''with bold deactivated''' in between.'''''
920 '''''Bold italic text ''with italic deactivated'' in between.'''''
922 '''Bold text..
924 ..spanning two paragraphs (should not work).'''
926 '''Bold tag left open
928 ''Italic tag left open
930 Normal text.
932 <!-- Unmatching number of opening, closing tags: -->
933 '''This year''''s election ''should'' beat '''last year''''s.
935 ''Tom'''s car is bigger than ''Susan'''s.
936 !! result
937 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
938 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
939 </p><p><b>Bold text..</b>
940 </p><p>..spanning two paragraphs (should not work).
941 </p><p><b>Bold tag left open</b>
942 </p><p><i>Italic tag left open</i>
943 </p><p>Normal text.
944 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
945 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
946 </p>
947 !! end
950 ### Tables
952 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
955 # This should not produce <table></table> as <table><tr><td></td></tr></table>
956 # is the bare minimun required by the spec, see:
957 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
958 !! test
959 A table with no data.
960 !! input
961 {||}
962 !! result
963 !! end
965 # A table with nothing but a caption is invalid XHTML, we might want to render
966 # this as <p>caption</p>
967 !! test
968 A table with nothing but a caption
969 !! input 
971 |+ caption
973 !! result
974 <table>
975 <caption> caption
976 </caption><tr><td></td></tr></table>
978 !! end
980 !! test
981 Simple table
982 !! input
983 {| 
984 | 1 || 2
985 |- 
986 | 3 || 4
988 !! result
989 <table>
990 <tr>
991 <td> 1 </td><td> 2
992 </td></tr>
993 <tr>
994 <td> 3 </td><td> 4
995 </td></tr></table>
997 !! end
999 !! test
1000 Multiplication table
1001 !! input
1002 {| border="1" cellpadding="2"
1003 |+Multiplication table
1005 ! &times; !! 1 !! 2 !! 3
1007 ! 1
1008 | 1 || 2 || 3
1010 ! 2
1011 | 2 || 4 || 6
1013 ! 3
1014 | 3 || 6 || 9
1016 ! 4
1017 | 4 || 8 || 12
1019 ! 5
1020 | 5 || 10 || 15
1022 !! result
1023 <table border="1" cellpadding="2">
1024 <caption>Multiplication table
1025 </caption>
1026 <tr>
1027 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1028 </th></tr>
1029 <tr>
1030 <th> 1
1031 </th><td> 1 </td><td> 2 </td><td> 3
1032 </td></tr>
1033 <tr>
1034 <th> 2
1035 </th><td> 2 </td><td> 4 </td><td> 6
1036 </td></tr>
1037 <tr>
1038 <th> 3
1039 </th><td> 3 </td><td> 6 </td><td> 9
1040 </td></tr>
1041 <tr>
1042 <th> 4
1043 </th><td> 4 </td><td> 8 </td><td> 12
1044 </td></tr>
1045 <tr>
1046 <th> 5
1047 </th><td> 5 </td><td> 10 </td><td> 15
1048 </td></tr></table>
1050 !! end
1052 !! test
1053 Table rowspan
1054 !! input
1055 {| align=right border=1
1056 | Cell 1, row 1 
1057 |rowspan=2| Cell 2, row 1 (and 2) 
1058 | Cell 3, row 1 
1059 |- 
1060 | Cell 1, row 2 
1061 | Cell 3, row 2 
1063 !! result
1064 <table align="right" border="1">
1065 <tr>
1066 <td> Cell 1, row 1
1067 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1068 </td><td> Cell 3, row 1
1069 </td></tr>
1070 <tr>
1071 <td> Cell 1, row 2
1072 </td><td> Cell 3, row 2
1073 </td></tr></table>
1075 !! end
1077 !! test
1078 Nested table
1079 !! input
1080 {| border=1
1081 | &alpha;
1083 {| bgcolor=#ABCDEF border=2
1084 |nested
1086 |table
1088 |the original table again
1090 !! result
1091 <table border="1">
1092 <tr>
1093 <td> &alpha;
1094 </td><td>
1095 <table bgcolor="#ABCDEF" border="2">
1096 <tr>
1097 <td>nested
1098 </td></tr>
1099 <tr>
1100 <td>table
1101 </td></tr></table>
1102 </td><td>the original table again
1103 </td></tr></table>
1105 !! end
1107 !! test
1108 Invalid attributes in table cell (bug 1830)
1109 !! input
1111 |Cell:|broken
1113 !! result
1114 <table>
1115 <tr>
1116 <td>broken
1117 </td></tr></table>
1119 !! end
1122 # FIXME: this one has incorrect tag nesting still.
1123 !! test
1124 Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)
1125 !! input
1127 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1128 !! result
1129 <table>
1130 <tr>
1131 <td><a href="ftp://|x||" class='external autonumber' title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
1132 </td>
1133 </tr>
1134 </table>
1136 !! end
1140 ### Internal links
1142 !! test
1143 Plain link, capitalized
1144 !! input
1145 [[Main Page]]
1146 !! result
1147 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1148 </p>
1149 !! end
1151 !! test
1152 Plain link, uncapitalized
1153 !! input
1154 [[main Page]]
1155 !! result
1156 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1157 </p>
1158 !! end
1160 !! test
1161 Piped link
1162 !! input
1163 [[Main Page|The Main Page]]
1164 !! result
1165 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1166 </p>
1167 !! end
1169 !! test
1170 Broken link
1171 !! input
1172 [[Zigzagzogzagzig]]
1173 !! result
1174 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
1175 </p>
1176 !! end
1178 !! test
1179 Link with prefix
1180 !! input
1181 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1182 !! result
1183 <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>
1184 </p>
1185 !! end
1187 !! test
1188 Link with suffix
1189 !! input
1190 [[Main Page]]xxx, [[Main Page]]XXX
1191 !! result
1192 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
1193 </p>
1194 !! end
1196 !! test
1197 Link with 3 brackets
1198 !! input
1199 [[[main page]]]
1200 !! result
1201 <p>[[[main page]]]
1202 </p>
1203 !! end
1205 !! test
1206 Piped link with 3 brackets
1207 !! input
1208 [[[main page|the main page]]]
1209 !! result
1210 <p>[[[main page|the main page]]]
1211 </p>
1212 !! end
1214 !! test
1215 Link with multiple pipes
1216 !! input
1217 [[Main Page|The|Main|Page]]
1218 !! result
1219 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1220 </p>
1221 !! end
1223 !! test
1224 Link to namespaces
1225 !! input
1226 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1227 !! result
1228 <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>
1229 </p>
1230 !! end
1232 !! test
1233 Piped link to namespace
1234 !! input
1235 [[Meta:Disclaimers|The disclaimers]]
1236 !! result
1237 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
1238 </p>
1239 !! end
1241 !! test
1242 Link containing }
1243 !! input
1244 [[Usually caused by a typo (oops}]]
1245 !! result
1246 <p>[[Usually caused by a typo (oops}]]
1247 </p>
1248 !! end
1250 !! test
1251 Link containing % (not as a hex sequence)
1252 !! input
1253 [[7% Solution]]
1254 !! result
1255 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1256 </p>
1257 !! end
1259 !! test
1260 Link containing % as a single hex sequence interpreted to char
1261 !! input
1262 [[7%25 Solution]]
1263 !! result
1264 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1265 </p>
1266 !!end
1268 !! test
1269 Link containing % as a double hex sequence interpreted to hex sequence
1270 !! input
1271 [[7%2525 Solution]]
1272 !! result
1273 <p>[[7%2525 Solution]]
1274 </p>
1275 !!end
1277 !! test
1278 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1279 Example for such a section: == < ==
1280 !! input
1281 [[%23%3c]][[%23%3e]]
1282 !! result
1283 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1284 </p>
1285 !! end
1287 !! test
1288 Link containing "<#" and ">#" as a hex sequences
1289 !! input
1290 [[%3c%23]][[%3e%23]]
1291 !! result
1292 <p>[[%3c%23]][[%3e%23]]
1293 </p>
1294 !! end
1296 !! test
1297 Link containing double-single-quotes '' (bug 4598)
1298 !! input
1299 [[Lista d''e paise d''o munno]]
1300 !! result
1301 <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>
1302 </p>
1303 !! end
1305 !! test
1306 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1307 !! input
1308 Some [[Link|pretty ''italics'' and stuff]]!
1309 !! result
1310 <p>Some <a href="/index.php?title=Link&amp;action=edit" class="new" title="Link">pretty <i>italics</i> and stuff</a>!
1311 </p>
1312 !! end
1314 !! test
1315 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1316 !! input
1317 ''Some [[Link|pretty ''italics'' and stuff]]!
1318 !! result
1319 <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>
1320 </p>
1321 !! end
1323 !! test
1324 Plain link to URL
1325 !! input
1326 [[http://www.example.org]]
1327 !! result
1328 <p>[<a href="http://www.example.org" class='external autonumber' title="http://www.example.org" rel="nofollow">[1]</a>]
1329 </p>
1330 !! end
1332 # I'm fairly sure the expected result here is wrong.
1333 # We want these to be URL links, not pseudo-pages with URLs for titles....
1334 # However the current output is also pretty screwy.
1336 # ----
1337 # I'm changing it to match the current output--it arguably makes more
1338 # sense in the light of the test above. Old expected result was:
1339 #<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>
1340 #</p>
1341 # But I think this test is bordering on "garbage in, garbage out" anyway.
1342 # -- wtm
1343 !! test
1344 Piped link to URL
1345 !! input
1346 Piped link to URL: [[http://www.example.org|an example URL]]
1347 !! result
1348 <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>]
1349 </p>
1350 !! end
1352 !! test
1353 BUG 2: [[page|http://url/]] should link to page, not http://url/
1354 !! input
1355 [[Main Page|http://url/]]
1356 !! result
1357 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1358 </p>
1359 !! end
1361 !! test
1362 BUG 337: Escaped self-links should be bold
1363 !! options
1364 title=[[Bug462]]
1365 !! input
1366 [[Bu&#103;462]] [[Bug462]]
1367 !! result
1368 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1369 </p>
1370 !! end
1372 !! test
1373 Self-link to section should not be bold
1374 !! options
1375 title=[[Main Page]]
1376 !! input
1377 [[Main Page#section]]
1378 !! result
1379 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1380 </p>
1381 !! end
1383 !! test
1384 <nowiki> inside a link
1385 !! input
1386 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1387 !! result
1388 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1389 </p>
1390 !! end
1393 ### Interwiki links (see maintenance/interwiki.sql)
1396 !! test
1397 Inline interwiki link
1398 !! input
1399 [[MeatBall:SoftSecurity]]
1400 !! result
1401 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1402 </p>
1403 !! end
1405 !! test
1406 Inline interwiki link with empty title (bug 2372)
1407 !! input
1408 [[MeatBall:]]
1409 !! result
1410 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class='extiw' title="meatball:">MeatBall:</a>
1411 </p>
1412 !! end
1414 !! test
1415 Interwiki link encoding conversion (bug 1636)
1416 !! input
1417 *[[Wikipedia:ro:Olteni&#0355;a]]
1418 *[[Wikipedia:ro:Olteni&#355;a]]
1419 !! result
1420 <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>
1421 </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>
1422 </li></ul>
1424 !! end
1426 !! test
1427 Interwiki link with fragment (bug 2130)
1428 !! input
1429 [[MeatBall:SoftSecurity#foo]]
1430 !! result
1431 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1432 </p>
1433 !! end
1436 ## XHTML tidiness
1439 !! test
1440 <br> to <br />
1441 !! input
1442 1<br>2<br />3
1443 !! result
1444 <p>1<br />2<br />3
1445 </p>
1446 !! end
1448 !! test
1449 Incorrecly removing closing slashes from correctly formed XHTML
1450 !! input
1451 <br style="clear:both;" />
1452 !! result
1453 <p><br style="clear:both;" />
1454 </p>
1455 !! end
1457 !! test 
1458 Failing to transform badly formed HTML into correct XHTML
1459 !! input
1460 <br clear=left>
1461 <br clear=right>
1462 <br clear=all>
1463 !! result
1464 <p><br clear="left" />
1465 <br clear="right" />
1466 <br clear="all" />
1467 </p>
1468 !!end
1470 !! test 
1471 Horizontal ruler (should it add that extra space?)
1472 !! input 
1473 <hr>
1474 <hr >
1475 foo <hr
1476 > bar
1477 !! result 
1478 <hr />
1479 <hr />
1480 foo <hr /> bar
1482 !! end
1485 ### Block-level elements
1487 !! test
1488 Common list
1489 !! input
1490 *Common list
1491 * item 2
1492 *item 3
1493 !! result
1494 <ul><li>Common list
1495 </li><li> item 2
1496 </li><li>item 3
1497 </li></ul>
1499 !! end
1501 !! test
1502 Numbered list
1503 !! input
1504 #Numbered list
1505 #item 2
1506 # item 3
1507 !! result
1508 <ol><li>Numbered list
1509 </li><li>item 2
1510 </li><li> item 3
1511 </li></ol>
1513 !! end
1515 !! test
1516 Mixed list
1517 !! input
1518 *Mixed list
1519 *# with numbers
1520 ** and bullets
1521 *# and numbers
1522 *bullets again
1523 **bullet level 2
1524 ***bullet level 3
1525 ***#Number on level 4
1526 **bullet level 2
1527 **#Number on level 3
1528 **#Number on level 3
1529 *#number level 2
1530 *Level 1
1531 !! result
1532 <ul><li>Mixed list
1533 <ol><li> with numbers
1534 </li></ol>
1535 <ul><li> and bullets
1536 </li></ul>
1537 <ol><li> and numbers
1538 </li></ol>
1539 </li><li>bullets again
1540 <ul><li>bullet level 2
1541 <ul><li>bullet level 3
1542 <ol><li>Number on level 4
1543 </li></ol>
1544 </li></ul>
1545 </li><li>bullet level 2
1546 <ol><li>Number on level 3
1547 </li><li>Number on level 3
1548 </li></ol>
1549 </li></ul>
1550 <ol><li>number level 2
1551 </li></ol>
1552 </li><li>Level 1
1553 </li></ul>
1555 !! end
1557 !! test
1558 List items are not parsed correctly following a <pre> block (bug 785)
1559 !! input
1560 * <pre>foo</pre>
1561 * <pre>bar</pre>
1562 * zar
1563 !! result
1564 <ul><li> <pre>foo</pre>
1565 </li><li> <pre>bar</pre>
1566 </li><li> zar
1567 </li></ul>
1569 !! end
1572 ### Magic Words
1575 !! test
1576 Magic Word: {{CURRENTDAY}}
1577 !! input
1578 {{CURRENTDAY}}
1579 !! result
1580 <p>1
1581 </p>
1582 !! end
1584 !! test
1585 Magic Word: {{CURRENTDAY2}}
1586 !! input
1587 {{CURRENTDAY2}}
1588 !! result
1589 <p>01
1590 </p>
1591 !! end
1593 !! test
1594 Magic Word: {{CURRENTDAYNAME}}
1595 !! input
1596 {{CURRENTDAYNAME}}
1597 !! result
1598 <p>Thursday
1599 </p>
1600 !! end
1602 !! test
1603 Magic Word: {{CURRENTDOW}}
1604 !! input
1605 {{CURRENTDOW}}
1606 !! result
1607 <p>4
1608 </p>
1609 !! end
1611 !! test
1612 Magic Word: {{CURRENTMONTH}}
1613 !! input
1614 {{CURRENTMONTH}}
1615 !! result
1616 <p>01
1617 </p>
1618 !! end
1620 !! test
1621 Magic Word: {{CURRENTMONTHABBREV}}
1622 !! input
1623 {{CURRENTMONTHABBREV}}
1624 !! result
1625 <p>Jan
1626 </p>
1627 !! end
1629 !! test
1630 Magic Word: {{CURRENTMONTHNAME}}
1631 !! input
1632 {{CURRENTMONTHNAME}}
1633 !! result
1634 <p>January
1635 </p>
1636 !! end
1638 !! test
1639 Magic Word: {{CURRENTMONTHNAMEGEN}}
1640 !! input
1641 {{CURRENTMONTHNAMEGEN}}
1642 !! result
1643 <p>January
1644 </p>
1645 !! end
1647 !! test
1648 Magic Word: {{CURRENTTIME}}
1649 !! input
1650 {{CURRENTTIME}}
1651 !! result
1652 <p>00:02
1653 </p>
1654 !! end
1656 !! test
1657 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1658 !! input
1659 {{CURRENTWEEK}}
1660 !! result
1661 <p>1
1662 </p>
1663 !! end
1665 !! test
1666 Magic Word: {{CURRENTYEAR}}
1667 !! input
1668 {{CURRENTYEAR}}
1669 !! result
1670 <p>1970
1671 </p>
1672 !! end
1674 !! test
1675 Magic Word: {{FULLPAGENAME}}
1676 !! options
1677 title=[[User:Ævar Arnfjörð Bjarmason]]
1678 !! input
1679 {{FULLPAGENAME}}
1680 !! result
1681 <p>User:Ævar Arnfjörð Bjarmason
1682 </p>
1683 !! end
1685 !! test
1686 Magic Word: {{FULLPAGENAMEE}}
1687 !! options
1688 title=[[User:Ævar Arnfjörð Bjarmason]]
1689 !! input
1690 {{FULLPAGENAMEE}}
1691 !! result
1692 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1693 </p>
1694 !! end
1696 !! test
1697 Magic Word: {{NAMESPACE}}
1698 !! options
1699 title=[[User:Ævar Arnfjörð Bjarmason]]
1700 disabled # FIXME
1701 !! input
1702 {{NAMESPACE}}
1703 !! result
1704 <p>User
1705 </p>
1706 !! end
1708 !! test
1709 Magic Word: {{NAMESPACEE}}
1710 !! options
1711 title=[[User:Ævar Arnfjörð Bjarmason]]
1712 disabled # FIXME
1713 !! input
1714 {{NAMESPACEE}}
1715 !! result
1716 <p>User
1717 </p>
1718 !! end
1720 !! test
1721 Magic Word: {{NUMBEROFARTICLES}}
1722 !! input
1723 {{NUMBEROFARTICLES}}
1724 !! result
1725 <p>1
1726 </p>
1727 !! end
1729 !! test
1730 Magic Word: {{NUMBEROFFILES}}
1731 !! input
1732 {{NUMBEROFFILES}}
1733 !! result
1734 <p>1
1735 </p>
1736 !! end
1738 !! test
1739 Magic Word: {{PAGENAME}}
1740 !! options
1741 title=[[User:Ævar Arnfjörð Bjarmason]]
1742 disabled # FIXME
1743 !! input
1744 {{PAGENAME}}
1745 !! result
1746 <p>Ævar Arnfjörð Bjarmason
1747 </p>
1748 !! end
1750 !! test
1751 Magic Word: {{PAGENAMEE}}
1752 !! options
1753 title=[[User:Ævar Arnfjörð Bjarmason]]
1754 !! input
1755 {{PAGENAMEE}}
1756 !! result
1757 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1758 </p>
1759 !! end
1761 !! test
1762 Magic Word: {{REVISIONID}}
1763 !! input
1764 {{REVISIONID}}
1765 !! result
1766 <p>1337
1767 </p>
1768 !! end
1770 !! test
1771 Magic Word: {{SCRIPTPATH}}
1772 !! input
1773 {{SCRIPTPATH}}
1774 !! result
1775 <p>/
1776 </p>
1777 !! end
1779 !! test
1780 Magic Word: {{SERVER}}
1781 !! input
1782 {{SERVER}}
1783 !! result
1784 <p><a href="http://localhost" class='external free' title="http://localhost" rel="nofollow">http://localhost</a>
1785 </p>
1786 !! end
1788 !! test
1789 Magic Word: {{SERVERNAME}}
1790 !! input
1791 {{SERVERNAME}}
1792 !! result
1793 <p>Britney Spears
1794 </p>
1795 !! end
1797 !! test
1798 Magic Word: {{SITENAME}}
1799 !! input
1800 {{SITENAME}}
1801 !! result
1802 <p>MediaWiki
1803 </p>
1804 !! end
1806 !! test
1807 Namespace 1 {{ns:1}}
1808 !! input
1809 {{ns:1}}
1810 !! result
1811 <p>Talk
1812 </p>
1813 !! end
1815 !! test
1816 Namespace 1 {{ns:01}}
1817 !! input
1818 {{ns:01}}
1819 !! result
1820 <p>Talk
1821 </p>
1822 !! end
1824 !! test
1825 Namespace 0 {{ns:0}} (bug 4783)
1826 !! input
1827 {{ns:0}}
1828 !! result
1830 !! end
1832 !! test
1833 Namespace 0 {{ns:00}} (bug 4783)
1834 !! input
1835 {{ns:00}}
1836 !! result
1838 !! end
1840 !! test
1841 Namespace -1 {{ns:-1}}
1842 !! input
1843 {{ns:-1}}
1844 !! result
1845 <p>Special
1846 </p>
1847 !! end
1849 !! test
1850 Namespace Project {{ns:User}}
1851 !! input
1852 {{ns:User}}
1853 !! result
1854 <p>User
1855 </p>
1856 !! end
1860 ### Magic links
1862 !! test
1863 Magic links: internal link to RFC (bug 479)
1864 !! input
1865 [[RFC 123]]
1866 !! result
1867 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1868 </p>
1869 !! end
1871 !! test
1872 Magic links: RFC (bug 479)
1873 !! input
1874 RFC 822
1875 !! result
1876 <p><a href='http://www.ietf.org/rfc/rfc822.txt' class='external' title="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a>
1877 </p>
1878 !! end
1880 !! test
1881 Magic links: ISBN (bug 1937)
1882 !! input
1883 ISBN 0-306-40615-2
1884 !! result
1885 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1886 </p>
1887 !! end
1889 !! test
1890 Magic links: PMID incorrectly converts space to underscore
1891 !! input
1892 PMID 1234
1893 !! result
1894 <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>
1895 </p>
1896 !! end
1899 ### Templates
1900 ####
1902 !! test
1903 Nonexistant template
1904 !! input
1905 {{thistemplatedoesnotexist}}
1906 !! result
1907 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1908 </p>
1909 !! end
1911 !! article
1912 Template:test
1913 !! text
1914 This is a test template
1915 !! endarticle
1917 !! test
1918 Simple template
1919 !! input
1920 {{test}}
1921 !! result
1922 <p>This is a test template
1923 </p>
1924 !! end
1926 !! test
1927 Template with explicit namespace
1928 !! input
1929 {{Template:test}}
1930 !! result
1931 <p>This is a test template
1932 </p>
1933 !! end
1936 !! article
1937 Template:paramtest
1938 !! text
1939 This is a test template with parameter {{{param}}}
1940 !! endarticle
1942 !! test
1943 Template parameter
1944 !! input
1945 {{paramtest|param=foo}}
1946 !! result
1947 <p>This is a test template with parameter foo
1948 </p>
1949 !! end
1951 !! article
1952 Template:paramtestnum
1953 !! text
1954 [[{{{1}}}|{{{2}}}]]
1955 !! endarticle
1957 !! test
1958 Template unnamed parameter
1959 !! input
1960 {{paramtestnum|Main Page|the main page}}
1961 !! result
1962 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
1963 </p>
1964 !! end
1966 !! article
1967 Template:templatesimple
1968 !! text
1969 (test)
1970 !! endarticle
1972 !! article
1973 Template:templateredirect
1974 !! text
1975 #redirect [[Template:templatesimple]]
1976 !! endarticle
1978 !! article
1979 Template:templateasargtestnum
1980 !! text
1981 {{{{{1}}}}}
1982 !! endarticle
1984 !! article
1985 Template:templateasargtest
1986 !! text
1987 {{template{{{templ}}}}}
1988 !! endarticle
1990 !! article
1991 Template:templateasargtest2
1992 !! text
1993 {{{{{templ}}}}}
1994 !! endarticle
1996 !! test
1997 Template with template name as unnamed argument
1998 !! input
1999 {{templateasargtestnum|templatesimple}}
2000 !! result
2001 <p>(test)
2002 </p>
2003 !! end
2005 !! test
2006 Template with template name as argument
2007 !! input
2008 {{templateasargtest|templ=simple}}
2009 !! result
2010 <p>(test)
2011 </p>
2012 !! end
2014 !! test
2015 Template with template name as argument (2)
2016 !! input
2017 {{templateasargtest2|templ=templatesimple}}
2018 !! result
2019 <p>(test)
2020 </p>
2021 !! end
2023 !! article
2024 Template:templateasargtestdefault
2025 !! text
2026 {{{{{templ|templatesimple}}}}}
2027 !! endarticle
2029 !! article
2030 Template:templa
2031 !! text
2032 '''templ'''
2033 !! endarticle
2035 !! test
2036 Template with default value
2037 !! input
2038 {{templateasargtestdefault}}
2039 !! result
2040 <p>(test)
2041 </p>
2042 !! end
2044 !! test
2045 Template with default value (value set)
2046 !! input
2047 {{templateasargtestdefault|templ=templa}}
2048 !! result
2049 <p><b>templ</b>
2050 </p>
2051 !! end
2053 !! test
2054 Template redirect
2055 !! input
2056 {{templateredirect}}
2057 !! result
2058 <p>(test)
2059 </p>
2060 !! end
2062 !! test
2063 Template with argument in separate line
2064 !! input
2065 {{ templateasargtest  |
2066  templ = simple }}
2067 !! result
2068 <p>(test)
2069 </p>
2070 !! end
2072 !! test
2073 Template with complex template as argument
2074 !! input
2075 {{paramtest|
2076   param ={{ templateasargtest  |
2077  templ = simple }}}}
2078 !! result
2079 <p>This is a test template with parameter (test)
2080 </p>
2081 !! end
2083 !! test
2084 Template with thumb image (wiht link in description)
2085 !! input
2086 {{paramtest|
2087   param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2088 !! result
2089 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>
2091 !! end
2093 !! article
2094 Template:complextemplate
2095 !! text
2096 {{{1}}} {{paramtest|
2097   param ={{{param}}}}}
2098 !! endarticle
2100 !! test
2101 Template with complex arguments
2102 !! input
2103 {{complextemplate|
2104   param ={{ templateasargtest  |
2105  templ = simple }}|[[Template:complextemplate|link]]}}
2106 !! result
2107 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2108 </p>
2109 !! end
2111 !! test
2112 BUG 553: link with two variables in a piped link
2113 !! input
2114 {| 
2115 |[[{{{1}}}|{{{2}}}]]
2117 !! result
2118 <table>
2119 <tr>
2120 <td>[[{{{1}}}|{{{2}}}]]
2121 </td></tr></table>
2123 !! end
2125 !! test
2126 Magic variable as template parameter
2127 !! input
2128 {{paramtest|param={{SITENAME}}}}
2129 !! result
2130 <p>This is a test template with parameter MediaWiki
2131 </p>
2132 !! end
2134 !! article
2135 Template:linktest
2136 !! text
2137 [[{{{param}}}|link]]
2138 !! endarticle
2140 !! test
2141 Template parameter as link source
2142 !! input
2143 {{linktest|param=Main Page}}
2144 !! result
2145 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2146 </p>
2147 !! end
2150 !!article
2151 Template:paramtest2
2152 !! text
2153 including another template, {{paramtest|param={{{arg}}}}}
2154 !! endarticle
2156 !! test
2157 Template passing argument to another template
2158 !! input
2159 {{paramtest2|arg='hmm'}}
2160 !! result
2161 <p>including another template, This is a test template with parameter 'hmm'
2162 </p>
2163 !! end
2165 !! article
2166 Template:Linktest2
2167 !! text
2168 Main Page
2169 !! endarticle
2171 !! test
2172 Template as link source
2173 !! input
2174 [[{{linktest2}}]]
2175 !! result
2176 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2177 </p>
2178 !! end
2181 !! article
2182 Template:loop1
2183 !! text
2184 {{loop2}}
2185 !! endarticle
2187 !! article
2188 Template:loop2
2189 !! text
2190 {{loop1}}
2191 !! endarticle
2193 !! test
2194 Template infinite loop
2195 !! input
2196 {{loop1}}
2197 !! result
2198 <p>{{loop1}}<!-- WARNING: template loop detected -->
2199 </p>
2200 !! end
2202 !! test
2203 Template from main namespace
2204 !! input
2205 {{:Main Page}}
2206 !! result
2207 <p>blah blah
2208 </p>
2209 !! end
2211 !! article
2212 Template:table
2213 !! text
2214 {| 
2215 | 1 || 2
2216 |- 
2217 | 3 || 4
2219 !! endarticle
2221 !! test
2222 BUG 529: Template with table, not included at beginning of line
2223 !! input
2224 foo {{table}}
2225 !! result
2226 <p>foo 
2227 </p>
2228 <table>
2229 <tr>
2230 <td> 1 </td><td> 2
2231 </td></tr>
2232 <tr>
2233 <td> 3 </td><td> 4
2234 </td></tr></table>
2236 !! end
2238 !! test
2239 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2240 !! input
2242 {{table}}
2243 !! result
2244 <p>foo
2245 </p>
2246 <table>
2247 <tr>
2248 <td> 1 </td><td> 2
2249 </td></tr>
2250 <tr>
2251 <td> 3 </td><td> 4
2252 </td></tr></table>
2254 !! end
2256 !! test
2257 BUG 41: Template parameters shown as broken links
2258 !! input
2259 {{{parameter}}}
2260 !! result
2261 <p>{{{parameter}}}
2262 </p>
2263 !! end
2266 !! article
2267 Template:MSGNW test
2268 !! text
2269 ''None'' of '''this''' should be 
2270 * interepreted
2271  but rather passed unmodified
2272 {{test}}
2273 !! endarticle
2275 # hmm, fix this or just deprecate msgnw and document its behavior?
2276 !! test
2277 msgnw keyword
2278 !! options
2279 disabled
2280 !! input
2281 {{msgnw:MSGNW test}}
2282 !! result
2283 <p>''None'' of '''this''' should be 
2284 * interepreted
2285  but rather passed unmodified
2286 {{test}}
2287 </p>
2288 !! end
2290 !! test
2291 int keyword
2292 !! input
2293 {{int:youhavenewmessages|lots of money|not!}}
2294 !! result
2295 <p>You have lots of money (not!).
2296 </p>
2297 !! end
2299 !! article
2300 Template:Includes
2301 !! text
2302 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2303 !! endarticle
2305 !! test
2306 <includeonly> and <noinclude> being included
2307 !! input
2308 {{Includes}}
2309 !! result
2310 <p>Foobar
2311 </p>
2312 !! end
2314 !! article
2315 Template:Includes2
2316 !! text
2317 <onlyinclude>Foo</onlyinclude>bar
2318 !! endarticle
2320 !! test
2321 <onlyinclude> being included
2322 !! input
2323 {{Includes2}}
2324 !! result
2325 <p>Foo
2326 </p>
2327 !! end
2330 !! article
2331 Template:Includes3
2332 !! text
2333 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2334 !! endarticle
2336 !! test
2337 <onlyinclude> and <includeonly> being included
2338 !! input
2339 {{Includes3}}
2340 !! result
2341 <p>Foo
2342 </p>
2343 !! end
2345 !! test
2346 <includeonly> and <noinclude> on a page
2347 !! input
2348 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2349 !! result
2350 <p>Foozar
2351 </p>
2352 !! end
2354 !! test
2355 <onlyinclude> on a page
2356 !! input
2357 <onlyinclude>Foo</onlyinclude>bar
2358 !! result
2359 <p>Foobar
2360 </p>
2361 !! end
2364 ### Pre-save transform tests
2366 !! test
2367 pre-save transform: subst:
2368 !! options
2370 !! input
2371 {{subst:test}}
2372 !! result
2373 This is a test template
2374 !! end
2376 !! test
2377 pre-save transform: normal template
2378 !! options
2380 !! input
2381 {{test}}
2382 !! result
2383 {{test}}
2384 !! end
2386 !! test
2387 pre-save transform: nonexistant template
2388 !! options
2390 !! input
2391 {{thistemplatedoesnotexist}}
2392 !! result
2393 {{thistemplatedoesnotexist}}
2394 !! end
2397 !! test
2398 pre-save transform: subst magic variables
2399 !! options
2401 !! input
2402 {{subst:SITENAME}}
2403 !! result
2404 MediaWiki
2405 !! end
2407 # This is bug 89, which I fixed. -- wtm
2408 !! test
2409 pre-save transform: subst: templates with parameters
2410 !! options
2412 !! input
2413 {{subst:paramtest|param="something else"}}
2414 !! result
2415 This is a test template with parameter "something else"
2416 !! end
2418 !! article
2419 Template:nowikitest
2420 !! text
2421 <nowiki>'''not wiki'''</nowiki>
2422 !! endarticle
2424 !! test
2425 pre-save transform: nowiki in subst (bug 1188)
2426 !! options
2428 !! input
2429 {{subst:nowikitest}}
2430 !! result
2431 <nowiki>'''not wiki'''</nowiki>
2432 !! end
2435 !! article
2436 Template:commenttest
2437 !! text
2438 This template has <!-- a comment --> in it.
2439 !! endarticle
2441 !! test
2442 pre-save transform: comment in subst (bug 1936)
2443 !! options
2445 !! input
2446 {{subst:commenttest}}
2447 !! result
2448 This template has <!-- a comment --> in it.
2449 !! end
2451 !! test
2452 pre-save transform: unclosed tag
2453 !! options
2454 pst noxml
2455 !! input
2456 <nowiki>'''not wiki'''
2457 !! result
2458 <nowiki>'''not wiki'''
2459 !! end
2461 !! test
2462 pre-save transform: mixed tag case
2463 !! options
2464 pst noxml
2465 !! input
2466 <NOwiki>'''not wiki'''</noWIKI>
2467 !! result
2468 <NOwiki>'''not wiki'''</noWIKI>
2469 !! end
2471 !! test
2472 pre-save transform: unclosed comment in <nowiki>
2473 !! options
2474 pst noxml
2475 !! input
2476 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2477 !! result
2478 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2479 !!end
2481 !! article
2482 Template:dangerous
2483 !!text
2484 <span onmouseover="alert('crap')">Oh no</span>
2485 !!endarticle
2487 !!test
2488 (confirming safety of fix for subst bug 1936)
2489 !! input
2490 {{Template:dangerous}}
2491 !! result
2492 <p><span>Oh no</span>
2493 </p>
2494 !! end
2496 !! test
2497 pre-save transform: comment containing gallery (bug 5024)
2498 !! options
2500 !! input
2501 <!-- <gallery>data</gallery> -->
2502 !!result
2503 <!-- <gallery>data</gallery> -->
2504 !!end
2506 !! test
2507 pre-save transform: comment containing extension
2508 !! options
2510 !! input
2511 <!-- <tag>data</tag> -->
2512 !!result
2513 <!-- <tag>data</tag> -->
2514 !!end
2516 !! test
2517 pre-save transform: comment containing nowiki
2518 !! options
2520 !! input
2521 <!-- <nowiki>data</nowiki> -->
2522 !!result
2523 <!-- <nowiki>data</nowiki> -->
2524 !!end
2526 !! test
2527 pre-save transform: comment containing math
2528 !! options
2530 !! input
2531 <!-- <math>data</math> -->
2532 !!result
2533 <!-- <math>data</math> -->
2534 !!end
2538 ### Message transform tests
2540 !! test
2541 message transform: magic variables
2542 !! options
2544 !! input
2545 {{SITENAME}}
2546 !! result
2547 MediaWiki
2548 !! end
2550 !! test
2551 message transform: should not transform wiki markup
2552 !! options
2554 !! input
2555 ''test''
2556 !! result
2557 ''test''
2558 !! end
2561 ### Images
2563 !! test
2564 Simple image
2565 !! input
2566 [[Image:foobar.jpg]]
2567 !! result
2568 <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>
2569 </p>
2570 !! end
2572 !! test
2573 Right-aligned image
2574 !! input
2575 [[Image:foobar.jpg|right]]
2576 !! result
2577 <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>
2579 !! end
2581 !! test
2582 Image with caption
2583 !! input
2584 [[Image:foobar.jpg|right|Caption text]]
2585 !! result
2586 <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>
2588 !! end
2590 !! test
2591 Image with frame and link
2592 !! input
2593 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2594 !! result
2595 <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>
2597 !! end
2599 !! test
2600 Link to image page- image page normally doesn't exists, hence edit link
2601 TODO: Add test with existing image page
2602 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2603 !! input
2604 [[:Image:test]]
2605 !! result
2606 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2607 </p>
2608 !! end
2610 !! test
2611 Frameless image caption with a free URL
2612 !! input
2613 [[Image:foobar.jpg|http://example.com]]
2614 !! result
2615 <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>
2616 </p>
2617 !! end
2619 !! test
2620 Thumbnail image caption with a free URL
2621 !! input
2622 [[Image:foobar.jpg|thumb|http://example.com]]
2623 !! result
2624 <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>
2626 !! end
2628 !! test
2629 BUG 1887: A ISBN with a thumbnail
2630 !! input
2631 [[Image:foobar.jpg|thumb|ISBN 12354]]
2632 !! result
2633 <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>
2635 !! end
2637 !! test
2638 BUG 1887: A RFC with a thumbnail
2639 !! input
2640 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2641 !! result
2642 <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>
2644 !! end
2646 !! test
2647 BUG 1887: A mailto link with a thumbnail
2648 !! input
2649 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2650 !! result
2651 <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>
2653 !! end
2655 !! test
2656 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2657 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2658 !! input
2659 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2660 !! result
2661 <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>
2663 !! end
2665 !! test
2666 BUG 1887, part 2: A <math> with a thumbnail- math enabled
2667 !! options
2668 math
2669 !! input
2670 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2671 !! result
2672 <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>
2674 !! end
2676 # Pending resolution to bug 368
2677 !! test
2678 BUG 648: Frameless image caption with a link
2679 !! input
2680 [[Image:foobar.jpg|text with a [[link]] in it]]
2681 !! result
2682 <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>
2683 </p>
2684 !! end
2686 !! test
2687 BUG 648: Frameless image caption with a link (suffix)
2688 !! input
2689 [[Image:foobar.jpg|text with a [[link]]foo in it]]
2690 !! result
2691 <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>
2692 </p>
2693 !! end
2695 !! test
2696 BUG 648: Frameless image caption with an interwiki link
2697 !! input
2698 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
2699 !! result
2700 <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>
2701 </p>
2702 !! end
2704 !! test
2705 BUG 648: Frameless image caption with a piped interwiki link
2706 !! input
2707 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
2708 !! result
2709 <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>
2710 </p>
2711 !! end
2713 !! test
2714 Escape HTML special chars in image alt text
2715 !! input
2716 [[Image:foobar.jpg|& < > "]]
2717 !! result
2718 <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>
2719 </p>
2720 !! end
2722 !! test
2723 BUG 499: Alt text should have &#1234;, not &amp;1234;
2724 !! input
2725 [[Image:foobar.jpg|&#9792;]]
2726 !! result
2727 <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>
2728 </p>
2729 !! end
2731 !! test
2732 Broken image caption with link
2733 !! input
2734 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
2735 !! result
2736 <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.
2737 </p>
2738 !! end
2740 !! test
2741 Image caption containing another image
2742 !! input
2743 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
2744 !! result
2745 <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>
2747 !! end
2749 !! test
2750 Image caption containing a newline
2751 !! input
2752 [[Image:Foobar.jpg|This
2753 *is some text]]
2754 !! result
2755 <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>
2756 </p>
2757 !!end
2760 !! test
2761 Bug 3090: External links other than http: in image captions
2762 !! input
2763 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
2764 !! result
2765 <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>
2767 !! end
2771 ### Subpages
2773 !! article
2774 Subpage test/subpage
2775 !! text
2777 !! endarticle
2779 !! test
2780 Subpage link
2781 !! options
2782 subpage title=[[Subpage test]]
2783 !! input
2784 [[/subpage]]
2785 !! result
2786 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
2787 </p>
2788 !! end
2790 !! test
2791 Subpage noslash link
2792 !! options
2793 subpage title=[[Subpage test]]
2794 !!input
2795 [[/subpage/]]
2796 !! result
2797 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
2798 </p>
2799 !! end
2801 !! test
2802 Disabled subpages
2803 !! input
2804 [[/subpage]]
2805 !! result
2806 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
2807 </p>
2808 !! end
2810 !! test
2811 BUG 561: {{/Subpage}}
2812 !! options
2813 subpage title=[[Page]]
2814 !! input
2815 {{/Subpage}}
2816 !! result
2817 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
2818 </p>
2819 !! end
2822 ### Categories
2824 !! article
2825 Category:MediaWiki User's Guide
2826 !! text
2827 blah
2828 !! endarticle
2830 !! test
2831 Link to category
2832 !! input
2833 [[:Category:MediaWiki User's Guide]]
2834 !! result
2835 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
2836 </p>
2837 !! end
2839 !! test
2840 Simple category
2841 !! options
2843 !! input
2844 [[Category:MediaWiki User's Guide]]
2845 !! result
2846 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
2847 !! end
2850 ### Inter-language links
2852 !! test
2853 Inter-language links
2854 !! options
2856 !! input
2857 [[es:Alimento]]
2858 [[fr:Nourriture]]
2859 [[zh:&#39135;&#21697;]]
2860 !! result
2861 es:Alimento fr:Nourriture zh:食品
2862 !! end
2865 ### Sections
2867 !! test
2868 Basic section headings
2869 !! options
2870 title=[[Parser test script]]
2871 !! input
2872 == Headline 1 ==
2873 Some text
2875 ==Headline 2==
2876 More
2877 ===Smaller headline===
2878 Blah blah
2879 !! result
2880 <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>
2881 <p>Some text
2882 </p>
2883 <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>
2884 <p>More
2885 </p>
2886 <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>
2887 <p>Blah blah
2888 </p>
2889 !! end
2891 !! test
2892 Section headings with TOC
2893 !! options
2894 title=[[Parser test script]]
2895 !! input
2896 == Headline 1 ==
2897 === Subheadline 1 ===
2898 ===== Skipping a level =====
2899 ====== Skipping a level ======
2901 == Headline 2 ==
2902 Some text
2903 ===Another headline===
2904 !! result
2905 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
2906 <ul>
2907 <li class='toclevel-1'><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
2908 <ul>
2909 <li class='toclevel-2'><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
2910 <ul>
2911 <li class='toclevel-3'><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
2912 <ul>
2913 <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>
2914 </ul>
2915 </li>
2916 </ul>
2917 </li>
2918 </ul>
2919 </li>
2920 <li class='toclevel-1'><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
2921 <ul>
2922 <li class='toclevel-2'><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
2923 </ul>
2924 </li>
2925 </ul>
2926 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
2927 <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>
2928 <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>
2929 <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>
2930 <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>
2931 <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>
2932 <p>Some text
2933 </p>
2934 <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>
2936 !! end
2938 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
2939 !! test
2940 Handling of sections up to level 6 and beyond
2941 !! input 
2942 = Level 1 Heading=
2943 == Level 2 Heading==
2944 === Level 3 Heading===
2945 ==== Level 4 Heading====
2946 ===== Level 5 Heading=====
2947 ====== Level 6 Heading======
2948 ======= Level 7 Heading=======
2949 ======== Level 8 Heading========
2950 ========= Level 9 Heading=========
2951 ========== Level 10 Heading==========
2952 !! result
2953 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
2954 <ul>
2955 <li class='toclevel-1'><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
2956 <ul>
2957 <li class='toclevel-2'><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
2958 <ul>
2959 <li class='toclevel-3'><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
2960 <ul>
2961 <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>
2962 <ul>
2963 <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>
2964 <ul>
2965 <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>
2966 <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>
2967 <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>
2968 <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>
2969 <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>
2970 </ul>
2971 </li>
2972 </ul>
2973 </li>
2974 </ul>
2975 </li>
2976 </ul>
2977 </li>
2978 </ul>
2979 </li>
2980 </ul>
2981 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
2982 <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>
2983 <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>
2984 <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>
2985 <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>
2986 <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>
2987 <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>
2988 <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>
2989 <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>
2990 <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>
2991 <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>
2993 !! end
2995 !! test
2996 Resolving duplicate section names
2997 !! options
2998 title=[[Parser test script]]
2999 !! input
3000 == Foo bar ==
3001 == Foo bar ==
3002 !! result
3003 <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>
3004 <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>
3006 !! end
3008 !! article
3009 Template:sections
3010 !! text
3011 ===Section 1===
3012 ==Section 2==
3013 !! endarticle
3015 !! test
3016 Template with sections, __NOTOC__
3017 !! options
3018 title=[[Parser test script]]
3019 !! input
3020 __NOTOC__
3021 ==Section 0==
3022 {{sections}}
3023 ==Section 4==
3024 !! result
3025 <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>
3026 <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>
3027 <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>
3028 <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>
3030 !! end
3032 !! test
3033 __NOEDITSECTION__ keyword
3034 !! input
3035 __NOEDITSECTION__
3036 ==Section 1==
3037 ==Section 2==
3038 !! result
3039 <a name="Section_1"></a><h2>Section 1</h2>
3040 <a name="Section_2"></a><h2>Section 2</h2>
3042 !! end
3044 !! test
3045 Link inside a section heading
3046 !! options
3047 title=[[Parser test script]]
3048 !! input
3049 ==Section with a [[Main Page|link]] in it==
3050 !! result
3051 <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>
3053 !! end
3056 !! test
3057 BUG 1219 URL next to image (good)
3058 !! input
3059 http://example.com [[Image:foobar.jpg]]
3060 !! result
3061 <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>
3062 </p>
3063 !!end
3065 !! test
3066 BUG 1219 URL next to image (broken)
3067 !! input
3068 http://example.com[[Image:foobar.jpg]]
3069 !! result
3070 <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>
3071 </p>
3072 !!end
3074 !! test
3075 Bug 1186 news: in the middle of text
3076 !! input
3077 http://en.wikinews.org/wiki/Wikinews:Workplace
3078 !! result
3079 <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>
3080 </p>
3081 !!end
3084 !! test
3085 Namespaced link must have a title
3086 !! input
3087 [[Project:]]
3088 !! result
3089 <p>[[Project:]]
3090 </p>
3091 !!end
3093 !! test
3094 Namespaced link must have a title (bad fragment version)
3095 !! input
3096 [[Project:#fragment]]
3097 !! result
3098 <p>[[Project:#fragment]]
3099 </p>
3100 !!end
3103 !! test
3104 div with no attributes
3105 !! input
3106 <div>HTML rocks</div>
3107 !! result
3108 <div>HTML rocks</div>
3110 !! end
3112 !! test
3113 div with double-quoted attribute
3114 !! input
3115 <div id="rock">HTML rocks</div>
3116 !! result
3117 <div id="rock">HTML rocks</div>
3119 !! end
3121 !! test
3122 div with single-quoted attribute
3123 !! input
3124 <div id='rock'>HTML rocks</div>
3125 !! result
3126 <div id="rock">HTML rocks</div>
3128 !! end
3130 !! test
3131 div with unquoted attribute
3132 !! input
3133 <div id=rock>HTML rocks</div>
3134 !! result
3135 <div id="rock">HTML rocks</div>
3137 !! end
3139 !! test
3140 div with illegal double attributes
3141 !! input
3142 <div align="center" align="right">HTML rocks</div>
3143 !! result
3144 <div align="right">HTML rocks</div>
3146 !!end
3148 !! test
3149 HTML multiple attributes correction
3150 !! input
3151 <p class="error" class="awesome">Awesome!</p>
3152 !! result
3153 <p class="awesome">Awesome!</p>
3155 !!end
3157 !! test
3158 Table multiple attributes correction
3159 !! input
3161 !+ class="error" class="awesome"| status
3163 !! result
3164 <table>
3165 <tr>
3166 <th class="awesome"> status
3167 </th></tr></table>
3169 !!end
3171 !! test
3172 DIV IN UPPERCASE
3173 !! input
3174 <DIV ALIGN="center">HTML ROCKS</DIV>
3175 !! result
3176 <div align="center">HTML ROCKS</div>
3178 !!end
3181 !! test
3182 text with amp in the middle of nowhere
3183 !! input
3184 Remember AT&T?
3185 !!result
3186 <p>Remember AT&amp;T?
3187 </p>
3188 !! end
3190 !! test
3191 text with character entity: eacute
3192 !! input
3193 I always thought &eacute; was a cute letter.
3194 !! result
3195 <p>I always thought &eacute; was a cute letter.
3196 </p>
3197 !! end
3199 !! test
3200 text with undefined character entity: xacute
3201 !! input
3202 I always thought &xacute; was a cute letter.
3203 !! result
3204 <p>I always thought &amp;xacute; was a cute letter.
3205 </p>
3206 !! end
3210 ### Media links
3213 !! test
3214 Media link
3215 !! input
3216 [[Media:Foobar.jpg]]
3217 !! result
3218 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Media:Foobar.jpg</a>
3219 </p>
3220 !! end
3222 !! test
3223 Media link with text
3224 !! input
3225 [[Media:Foobar.jpg|A neat file to look at]]
3226 !! result
3227 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">A neat file to look at</a>
3228 </p>
3229 !! end
3231 # FIXME: this is still bad HTML tag nesting
3232 !! test
3233 Media link with nasty text
3234 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3235 !! input
3236 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3237 !! result
3238 <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>
3240 !! end
3242 !! test
3243 Media link to nonexistent file (bug 1702)
3244 !! input
3245 [[Media:No such.jpg]]
3246 !! result
3247 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class='new' title="No such.jpg">Media:No such.jpg</a>
3248 </p>
3249 !! end
3251 !! test
3252 Image link to nonexistent file (bug 1850 - good)
3253 !! input
3254 [[Image:No such.jpg]]
3255 !! result
3256 <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>
3257 </p>
3258 !! end
3260 !! test
3261 :Image link to nonexistent file (bug 1850 - bad)
3262 !! input
3263 [[:Image:No such.jpg]]
3264 !! result
3265 <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>
3266 </p>
3267 !! end
3271 !! test
3272 Character reference normalization in link text (bug 1938)
3273 !! input
3274 [[Main Page|this&that]]
3275 !! result
3276 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3277 </p>
3278 !!end
3280 !! test
3281 Empty attribute crash test (bug 2067)
3282 !! input
3283 <font color="">foo</font>
3284 !! result
3285 <p><font color="">foo</font>
3286 </p>
3287 !! end
3289 !! test
3290 Empty attribute crash test single-quotes (bug 2067)
3291 !! input
3292 <font color=''>foo</font>
3293 !! result
3294 <p><font color="">foo</font>
3295 </p>
3296 !! end
3298 !! test
3299 Attribute test: equals, then nothing
3300 !! input
3301 <font color=>foo</font>
3302 !! result
3303 <p><font>foo</font>
3304 </p>
3305 !! end
3307 !! test
3308 Attribute test: unquoted value
3309 !! input
3310 <font color=x>foo</font>
3311 !! result
3312 <p><font color="x">foo</font>
3313 </p>
3314 !! end
3316 !! test
3317 Attribute test: unquoted but illegal value (hash)
3318 !! input
3319 <font color=#x>foo</font>
3320 !! result
3321 <p><font color="#x">foo</font>
3322 </p>
3323 !! end
3325 !! test
3326 Attribute test: no value
3327 !! input
3328 <font color>foo</font>
3329 !! result
3330 <p><font color="color">foo</font>
3331 </p>
3332 !! end
3334 !! test
3335 Bug 2095: link with three closing brackets
3336 !! input
3337 [[Main Page]]]
3338 !! result
3339 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3340 </p>
3341 !! end
3343 !! test
3344 Bug 2095: link with pipe and three closing brackets
3345 !! input
3346 [[Main Page|link]]]
3347 !! result
3348 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3349 </p>
3350 !! end
3352 !! test
3353 Bug 2095: link with pipe and three closing brackets, version 2
3354 !! input
3355 [[Main Page|[http://example.com/]]]
3356 !! result
3357 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3358 </p>
3359 !! end
3363 ### Safety
3366 !! article
3367 Template:Dangerous attribute
3368 !! text
3369 " onmouseover="alert(document.cookie)
3370 !! endarticle
3372 !! article
3373 Template:Dangerous style attribute
3374 !! text
3375 border-size: expression(alert(document.cookie))
3376 !! endarticle
3378 !! article
3379 Template:Div style
3380 !! text
3381 <div style="float: right; {{{1}}}">Magic div</div>
3382 !! endarticle
3384 !! test
3385 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3386 !! input
3387 <div title="{{test}}"></div>
3388 !! result
3389 <div title="This is a test template"></div>
3391 !! end
3393 !! test
3394 Bug 2304: HTML attribute safety (dangerous template; 2309)
3395 !! input
3396 <div title="{{dangerous attribute}}"></div>
3397 !! result
3398 <div title=""></div>
3400 !! end
3402 !! test
3403 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3404 !! input
3405 <div style="{{dangerous style attribute}}"></div>
3406 !! result
3407 <div></div>
3409 !! end
3411 !! test
3412 Bug 2304: HTML attribute safety (safe parameter; 2309)
3413 !! input
3414 {{div style|width: 200px}}
3415 !! result
3416 <div style="float: right; width: 200px">Magic div</div>
3418 !! end
3420 !! test
3421 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3422 !! input
3423 {{div style|width: expression(alert(document.cookie))}}
3424 !! result
3425 <div>Magic div</div>
3427 !! end
3429 !! test
3430 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3431 !! input
3432 {{div style|"><script>alert(document.cookie)</script>}}
3433 !! result
3434 <div>Magic div</div>
3436 !! end
3438 !! test
3439 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3440 !! input
3441 {{div style|" ><script>alert(document.cookie)</script>}}
3442 !! result
3443 <div style="float: right; ">Magic div</div>
3445 !! end
3447 !! test
3448 Bug 2304: HTML attribute safety (link)
3449 !! input
3450 <div title="[[Main Page]]"></div>
3451 !! result
3452 <div title="&#91;&#91;Main Page]]"></div>
3454 !! end
3456 !! test
3457 Bug 2304: HTML attribute safety (italics)
3458 !! input
3459 <div title="''foobar''"></div>
3460 !! result
3461 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3463 !! end
3465 !! test
3466 Bug 2304: HTML attribute safety (bold)
3467 !! input
3468 <div title="'''foobar'''"></div>
3469 !! result
3470 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3472 !! end
3475 !! test
3476 Bug 2304: HTML attribute safety (ISBN)
3477 !! input
3478 <div title="ISBN 1234567890"></div>
3479 !! result
3480 <div title="&#73;SBN 1234567890"></div>
3482 !! end
3484 !! test
3485 Bug 2304: HTML attribute safety (RFC)
3486 !! input
3487 <div title="RFC 1234"></div>
3488 !! result
3489 <div title="&#82;FC 1234"></div>
3491 !! end
3493 !! test
3494 Bug 2304: HTML attribute safety (PMID)
3495 !! input
3496 <div title="PMID 1234567890"></div>
3497 !! result
3498 <div title="&#80;MID 1234567890"></div>
3500 !! end
3502 !! test
3503 Bug 2304: HTML attribute safety (web link)
3504 !! input
3505 <div title="http://example.com/"></div>
3506 !! result
3507 <div title="http&#58;//example.com/"></div>
3509 !! end
3511 !! test
3512 Bug 2304: HTML attribute safety (named web link)
3513 !! input
3514 <div title="[http://example.com/ link]"></div>
3515 !! result
3516 <div title="&#91;http&#58;//example.com/ link]"></div>
3518 !! end
3520 !! test
3521 Bug 3244: HTML attribute safety (extension; safe)
3522 !! input
3523 <div style="<nowiki>background:blue</nowiki>"></div>
3524 !! result
3525 <div style="background:blue"></div>
3527 !! end
3529 !! test
3530 Bug 3244: HTML attribute safety (extension; unsafe)
3531 !! input
3532 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3533 !! result
3534 <div></div>
3536 !! end
3538 !! test
3539 Math section safety when disabled
3540 !! input
3541 <math><script>alert(document.cookies);</script></math>
3542 !! result
3543 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3544 </p>
3545 !! end
3547 # More MSIE fun discovered by Tom Gilder
3549 !! test
3550 MSIE CSS safety test: spurious slash
3551 !! input
3552 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3553 !! result
3554 <div>evil</div>
3556 !! end
3558 !! test
3559 MSIE CSS safety test: hex code
3560 !! input
3561 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3562 !! result
3563 <div>evil</div>
3565 !! end
3567 !! test
3568 MSIE CSS safety test: comment in url
3569 !! input
3570 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3571 !! result
3572 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3574 !! end
3576 !! test
3577 MSIE CSS safety test: comment in expression
3578 !! input
3579 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3580 !! result
3581 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3583 !! end
3586 !! test
3587 Table attribute legitimate extension
3588 !! input
3590 !+ style="<nowiki>color:blue</nowiki>"| status
3592 !! result
3593 <table>
3594 <tr>
3595 <th style="color:blue"> status
3596 </th></tr></table>
3598 !!end
3600 !! test
3601 Table attribute safety
3602 !! input
3604 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3606 !! result
3607 <table>
3608 <tr>
3609 <th> status
3610 </th></tr></table>
3612 !! end
3615 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3617 !! test
3618 Parser hook: empty input
3619 !! input
3620 <tag></tag>
3621 !! result
3622 <pre>
3623 string(0) ""
3624 array(0) {
3626 </pre>
3628 !! end
3630 !! test
3631 Parser hook: empty input using terminated empty elements
3632 !! input
3633 <tag/>
3634 !! result
3635 <pre>
3636 NULL
3637 array(0) {
3639 </pre>
3641 !! end
3643 !! test
3644 Parser hook: empty input using terminated empty elements (space before)
3645 !! input
3646 <tag />
3647 !! result
3648 <pre>
3649 NULL
3650 array(0) {
3652 </pre>
3654 !! end
3656 !! test
3657 Parser hook: basic input
3658 !! input
3659 <tag>input</tag>
3660 !! result
3661 <pre>
3662 string(5) "input"
3663 array(0) {
3665 </pre>
3667 !! end
3670 !! test
3671 Parser hook: case insensetive
3672 !! input
3673 <TAG>input</TAG>
3674 !! result
3675 <pre>
3676 string(5) "input"
3677 array(0) {
3679 </pre>
3681 !! end
3684 !! test
3685 Parser hook: case insensetive, redux
3686 !! input
3687 <TaG>input</TAg>
3688 !! result
3689 <pre>
3690 string(5) "input"
3691 array(0) {
3693 </pre>
3695 !! end
3697 !! test
3698 Parser hook: nested tags
3699 !! options
3700 noxml
3701 !! input
3702 <tag><tag></tag></tag>
3703 !! result
3704 <pre>
3705 string(5) "<tag>"
3706 array(0) {
3708 </pre>&lt;/tag&gt;
3710 !! end
3712 !! test
3713 Parser hook: basic arguments
3714 !! input
3715 <tag width=200 height = "100" depth = '50' square></tag>
3716 !! result
3717 <pre>
3718 string(0) ""
3719 array(4) {
3720   ["width"]=>
3721   string(3) "200"
3722   ["height"]=>
3723   string(3) "100"
3724   ["depth"]=>
3725   string(2) "50"
3726   ["square"]=>
3727   string(6) "square"
3729 </pre>
3731 !! end
3733 !! test
3734 Parser hook: argument containing a forward slash (bug 5344)
3735 !! input
3736 <tag filename='/tmp/bla'></tag>
3737 !! result
3738 <pre>
3739 string(0) ""
3740 array(1) {
3741   ["filename"]=>
3742   string(8) "/tmp/bla"
3744 </pre>
3746 !! end
3748 !! test
3749 Parser hook: empty input using terminated empty elements (bug 2374)
3750 !! input
3751 <tag foo=bar/>text
3752 !! result
3753 <pre>
3754 NULL
3755 array(1) {
3756   ["foo"]=>
3757   string(3) "bar"
3759 </pre>text
3761 !! end
3763 # </tag> should be output literally since there is no matching tag that begins it
3764 !! test
3765 Parser hook: basic arguments using terminated empty elements (bug 2374)
3766 !! input
3767 <tag width=200 height = "100" depth = '50' square/>
3768 other stuff
3769 </tag>
3770 !! result
3771 <pre>
3772 NULL
3773 array(4) {
3774   ["width"]=>
3775   string(3) "200"
3776   ["height"]=>
3777   string(3) "100"
3778   ["depth"]=>
3779   string(2) "50"
3780   ["square"]=>
3781   string(6) "square"
3783 </pre>
3784 <p>other stuff
3785 &lt;/tag&gt;
3786 </p>
3787 !! end
3790 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
3793 !! test
3794 Parser hook: static parser hook not inside a comment
3795 !! input
3796 <statictag>hello, world</statictag>
3797 <statictag action=flush/>
3798 !! result
3799 <p>hello, world
3800 </p>
3801 !! end
3804 !! test
3805 Parser hook: static parser hook inside a comment
3806 !! input
3807 <!-- <statictag>hello, world</statictag> -->
3808 <statictag action=flush/>
3809 !! result
3810 <p><br />
3811 </p>
3812 !! end
3814 # Nested template calls; this case was broken by Parser.php rev 1.506,
3815 # since reverted.
3817 !! article
3818 Template:One-parameter
3819 !! text
3820 (My parameter is: {{{1}}})
3821 !! endarticle
3823 !! article
3824 Template:Map-one-parameter
3825 !! text
3826 {{{{{1}}}|{{{2}}}}}
3827 !! endarticle
3829 !! test
3830 Nested template calls
3831 !! input
3832 {{Map-one-parameter|One-parameter|param}}
3833 !! result
3834 <p>(My parameter is: param)
3835 </p>
3836 !! end
3840 ### Sanitizer
3842 !! test
3843 Sanitizer: Closing of open tags
3844 !! input
3845 <s></s><table></table>
3846 !! result
3847 <s></s><table></table>
3849 !! end
3851 !! test
3852 Sanitizer: Closing of open but not closed tags
3853 !! input
3854 <s>foo
3855 !! result
3856 <p><s>foo</s>
3857 </p>
3858 !! end
3860 !! test
3861 Sanitizer: Closing of closed but not open tags
3862 !! input
3863 </s>
3864 !! result
3865 <p>&lt;/s&gt;
3866 </p>
3867 !! end
3869 !! test
3870 Sanitizer: Closing of closed but not open table tags
3871 !! input
3872 Table not started</td></tr></table>
3873 !! result
3874 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
3875 </p>
3876 !! end
3878 !! test
3879 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
3880 !! input
3881 <span id="æ: v">byte</span>[[#æ: v|backlink]]
3882 !! result
3883 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
3884 </p>
3885 !! end
3887 !! test
3888 Sanitizer: Validating the contents of the id attribute (bug 4515)
3889 !! options
3890 disabled
3891 !! input
3892 <br id=9 />
3893 !! result
3894 Something, but defenetly not <br id="9" />...
3895 !! end
3897 !! test
3898 Language converter: output gets cut off unexpectedly (bug 5757)
3899 !! options
3900 language=zh
3901 !! input
3902 this bit is safe: }-
3904 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
3906 then we get cut off here: }-
3908 all additional text is vanished
3909 !! result
3910 <p>this bit is safe: }-
3911 </p><p>but if we add a conversion instance: xxx
3912 </p><p>then we get cut off here: }-
3913 </p><p>all additional text is vanished
3914 </p>
3915 !! end
3917 !! test
3918 Self closed html pairs (bug 5487)
3919 !! options
3920 !! input
3921 <center><font id="bug" />Centered text</center>
3922 <div><font id="bug2" />In div text</div>
3923 !! result
3924 <div class="center">&lt;font id="bug" /&gt;Centered text</div>
3925 <div>&lt;font id="bug2" /&gt;In div text</div>
3927 !! end
3933 !! test
3934 HTML bullet list, closed tags (bug 5497)
3935 !! input
3936 <ul>
3937 <li>One</li>
3938 <li>Two</li>
3939 </ul>
3940 !! result
3941 <ul>
3942 <li>One</li>
3943 <li>Two</li>
3944 </ul>
3946 !! end
3948 !! test
3949 HTML bullet list, unclosed tags (bug 5497)
3950 !! input
3951 <ul>
3952 <li>One
3953 <li>Two
3954 </ul>
3955 !! result
3956 <ul>
3957 <li>One
3958 </li><li>Two
3959 </li></ul>
3961 !! end
3963 !! test
3964 HTML ordered list, closed tags (bug 5497)
3965 !! input
3966 <ol>
3967 <li>One</li>
3968 <li>Two</li>
3969 </ol>
3970 !! result
3971 <ol>
3972 <li>One</li>
3973 <li>Two</li>
3974 </ol>
3976 !! end
3978 !! test
3979 HTML ordered list, unclosed tags (bug 5497)
3980 !! input
3981 <ol>
3982 <li>One
3983 <li>Two
3984 </ol>
3985 !! result
3986 <ol>
3987 <li>One
3988 </li><li>Two
3989 </li></ol>
3991 !! end
3993 !! test
3994 HTML nested bullet list, closed tags (bug 5497)
3995 !! input
3996 <ul>
3997 <li>One</li>
3998 <li>Two:
3999 <ul>
4000 <li>Sub-one</li>
4001 <li>Sub-two</li>
4002 </ul>
4003 </li>
4004 </ul>
4005 !! result
4006 <ul>
4007 <li>One</li>
4008 <li>Two:
4009 <ul>
4010 <li>Sub-one</li>
4011 <li>Sub-two</li>
4012 </ul>
4013 </li>
4014 </ul>
4016 !! end
4018 !! test
4019 HTML nested bullet list, open tags (bug 5497)
4020 !! input
4021 <ul>
4022 <li>One
4023 <li>Two:
4024 <ul>
4025 <li>Sub-one
4026 <li>Sub-two
4027 </ul>
4028 </ul>
4029 !! result
4030 <ul>
4031 <li>One
4032 </li><li>Two:
4033 <ul>
4034 <li>Sub-one
4035 </li><li>Sub-two
4036 </li></ul>
4037 </li></ul>
4039 !! end
4041 !! test
4042 HTML nested ordered list, closed tags (bug 5497)
4043 !! input
4044 <ol>
4045 <li>One</li>
4046 <li>Two:
4047 <ol>
4048 <li>Sub-one</li>
4049 <li>Sub-two</li>
4050 </ol>
4051 </li>
4052 </ol>
4053 !! result
4054 <ol>
4055 <li>One</li>
4056 <li>Two:
4057 <ol>
4058 <li>Sub-one</li>
4059 <li>Sub-two</li>
4060 </ol>
4061 </li>
4062 </ol>
4064 !! end
4066 !! test
4067 HTML nested ordered list, open tags (bug 5497)
4068 !! input
4069 <ol>
4070 <li>One
4071 <li>Two:
4072 <ol>
4073 <li>Sub-one
4074 <li>Sub-two
4075 </ol>
4076 </ol>
4077 !! result
4078 <ol>
4079 <li>One
4080 </li><li>Two:
4081 <ol>
4082 <li>Sub-one
4083 </li><li>Sub-two
4084 </li></ol>
4085 </li></ol>
4087 !! end
4089 !! test
4090 HTML ordered list item with parameters oddity
4091 !! input
4092 <ol><li id="fragment">One</li></ol>
4093 !! result
4094 <ol><li id="fragment">One</li></ol>
4096 !! end
4098 !!test
4099 bug 5918: autonumbering
4100 !! input
4101 [http://first/] [http://second] [ftp://ftp]
4103 ftp://inlineftp
4105 [mailto:enclosed@mail.tld With target]
4107 [mailto:enclosed@mail.tld]
4109 mailto:inline@mail.tld
4110 !! result
4111 <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>
4112 </p><p><a href="ftp://inlineftp" class='external free' title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4113 </p><p><a href="mailto:enclosed@mail.tld" class='external text' title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4114 </p><p><a href="mailto:enclosed@mail.tld" class='external autonumber' title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4115 </p><p><a href="mailto:inline@mail.tld" class='external free' title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4116 </p>
4117 !! end
4121 # Security and HTML correctness
4122 # From Nick Jenkins' fuzz testing
4125 !! test
4126 Fuzz testing: Parser13
4127 !! input
4128 {| 
4129 | http://a|
4130 !! result
4131 <table>
4132 <tr>
4133 <td>
4134 </td>
4135 </tr>
4136 </table>
4138 !! end
4140 !! test
4141 Fuzz testing: Parser14
4142 !! input
4143 == onmouseover= ==
4144 http://__TOC__
4145 !! result
4146 <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>
4147 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4148 <ul>
4149 <li class='toclevel-1'><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4150 </ul>
4151 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4153 !! end
4155 !! test
4156 Fuzz testing: Parser14-table
4157 !! input
4158 ==a==
4159 {| STYLE=__TOC__
4160 !! result
4161 <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>
4162 <table style="&#95;_TOC&#95;_">
4163 <tr><td></td></tr>
4164 </table>
4166 !! end
4168 # Known to produce bogus xml (extra </td>)
4169 !! test
4170 Fuzz testing: Parser16
4171 !! options
4172 noxml
4173 !! input
4175 !https://||||||
4176 !! result
4177 <table>
4178 <tr>
4179 <th>https://</th><th></th><th></th><th>
4180 </td>
4181 </tr>
4182 </table>
4184 !! end
4186 !! test
4187 Fuzz testing: Parser21
4188 !! input
4190 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4192 !! result
4193 <table>
4194 <tr>
4195 <th> <a href="irc://{{ftp://a" class='external free' title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4196 </th><td>
4197 </td>
4198 </tr>
4199 </table>
4201 !! end
4203 !! test
4204 Fuzz testing: Parser22
4205 !! input
4206 http://===r:::https://b
4209 !!result
4210 <p><a href="http://===r:::https://b" class='external free' title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4211 </p>
4212 <table>
4213 <tr><td></td></tr>
4214 </table>
4216 !! end
4218 # Known to produce bad XML for now
4219 !! test
4220 Fuzz testing: Parser24
4221 !! options
4222 noxml
4223 !! input
4225 {{{|
4226 <u CLASS=
4227 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4228 <br style="onmouseover='alert(document.cookie);' " />
4230 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4232 !! result
4233 <table>
4235 <u class="&#124;">} &gt;
4236 <br style="onmouseover='alert(document.cookie);' " />
4238 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4239 <tr>
4240 <td></u>
4241 </td>
4242 </tr>
4243 </table>
4245 !! end
4247 # Known to produce bad XML for now
4248 !!test
4249 Fuzz testing: Parser25 (bug 6055)
4250 !! options
4251 noxml
4252 !! input
4255 <LI CLASS=||
4257 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4258 !! result
4259 <li class="&#124;&#124;">
4260 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4262 !! end
4264 !!test
4265 Fuzz testing: URL adjacent extension (with space, clean)
4266 !! options
4267 !! input
4268 http://example.com <nowiki>junk</nowiki>
4269 !! result
4270 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> junk
4271 </p>
4272 !!end
4274 !!test
4275 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4276 !! options
4277 !! input
4278 http://example.com<nowiki>junk</nowiki>
4279 !! result
4280 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>junk
4281 </p>
4282 !!end
4284 !!test
4285 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4286 !! options
4287 !! input
4288 http://example.com<pre>junk</pre>
4289 !! result
4290 <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4292 !!end
4294 !!test
4295 Fuzz testing: image with bogus manual thumbnail
4296 !!input
4297 [[Image:foobar.jpg|thumbnail= ]]
4298 !!result
4299 <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>
4301 !!end
4303 !! test
4304 Parsing optional HTML elements (Bug 6171)
4305 !! options
4306 !! input
4307 <table>
4308   <tr>
4309     <td> Some tabular data</td>
4310     <td> More tabular data ...
4311     <td> And yet som tabular data</td>
4312   </tr>
4313 </table>
4314 !! result
4315 <table>
4316   <tr>
4317     <td> Some tabular data</td>
4318     <td> More tabular data ...
4319     </td><td> And yet som tabular data</td>
4320   </tr>
4321 </table>
4323 !! end
4325 !! test
4326 Correct handling of <td>, <tr> (Bug 6171)
4327 !! options
4328 !! input
4329 <table>
4330   <tr>
4331     <td> Some tabular data</td>
4332     <td> More tabular data ...</td>
4333     <td> And yet som tabular data</td>
4334   </tr>
4335 </table>
4336 !! result
4337 <table>
4338   <tr>
4339     <td> Some tabular data</td>
4340     <td> More tabular data ...</td>
4341     <td> And yet som tabular data</td>
4342   </tr>
4343 </table>
4345 !! end
4348 !! test
4349 Parsing crashing regression (fr:JavaScript)
4350 !! input
4351 </body></x>
4352 !! result
4353 <p>&lt;/body&gt;&lt;/x&gt;
4354 </p>
4355 !! end
4357 !! test
4358 Inline wiki vs wiki block nesting
4359 !! input
4360 '''Bold paragraph
4362 New wiki paragraph
4363 !! result
4364 <p><b>Bold paragraph</b>
4365 </p><p>New wiki paragraph
4366 </p>
4367 !! end
4369 !! test
4370 Inline HTML vs wiki block nesting
4371 !! input
4372 <b>Bold paragraph
4374 New wiki paragraph
4375 !! result
4376 <p><b>Bold paragraph</b>
4377 </p><p>New wiki paragraph
4378 </p>
4379 !! end
4382 !!test
4383 Mixing markup for italics and bold
4384 !! options
4385 !! input
4386 '''bold''''''bold''bolditalics'''''
4387 !! result
4388 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4389 </p>
4390 !! end
4393 !! article
4394 Xyzzyx
4395 !! text
4396 Article for special page transclusion test
4397 !! endarticle
4399 !! test
4400 Special page transclusion
4401 !! options
4402 !! input
4403 {{Special:Prefixindex/Xyzzyx}}
4404 !! result
4405 <p><br />
4406 </p>
4407 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4409 !! end
4411 !! test
4412 Special page transclusion twice (bug 5021)
4413 !! options
4414 !! input
4415 {{Special:Prefixindex/Xyzzyx}}
4416 {{Special:Prefixindex/Xyzzyx}}
4417 !! result
4418 <p><br />
4419 </p>
4420 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4421 <p><br />
4422 </p>
4423 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4425 !! end
4427 !! test
4428 Invalid header with following text
4429 !! input
4430 = x = y
4431 !! result
4432 <p>= x = y
4433 </p>
4434 !! end
4437 !! test
4438 Section extraction test (section 0)
4439 !! options
4440 section=0
4441 !! input
4442 start
4443 ==a==
4444 ===aa===
4445 ====aaa====
4446 ==b==
4447 ===ba===
4448 ===bb===
4449 ====bba====
4450 ===bc===
4451 ==c==
4452 ===ca===
4453 !! result
4454 start
4455 !! end
4457 !! test
4458 Section extraction test (section 1)
4459 !! options
4460 section=1
4461 !! input
4462 start
4463 ==a==
4464 ===aa===
4465 ====aaa====
4466 ==b==
4467 ===ba===
4468 ===bb===
4469 ====bba====
4470 ===bc===
4471 ==c==
4472 ===ca===
4473 !! result
4474 ==a==
4475 ===aa===
4476 ====aaa====
4477 !! end
4479 !! test
4480 Section extraction test (section 2)
4481 !! options
4482 section=2
4483 !! input
4484 start
4485 ==a==
4486 ===aa===
4487 ====aaa====
4488 ==b==
4489 ===ba===
4490 ===bb===
4491 ====bba====
4492 ===bc===
4493 ==c==
4494 ===ca===
4495 !! result
4496 ===aa===
4497 ====aaa====
4498 !! end
4500 !! test
4501 Section extraction test (section 3)
4502 !! options
4503 section=3
4504 !! input
4505 start
4506 ==a==
4507 ===aa===
4508 ====aaa====
4509 ==b==
4510 ===ba===
4511 ===bb===
4512 ====bba====
4513 ===bc===
4514 ==c==
4515 ===ca===
4516 !! result
4517 ====aaa====
4518 !! end
4520 !! test
4521 Section extraction test (section 4)
4522 !! options
4523 section=4
4524 !! input
4525 start
4526 ==a==
4527 ===aa===
4528 ====aaa====
4529 ==b==
4530 ===ba===
4531 ===bb===
4532 ====bba====
4533 ===bc===
4534 ==c==
4535 ===ca===
4536 !! result
4537 ==b==
4538 ===ba===
4539 ===bb===
4540 ====bba====
4541 ===bc===
4542 !! end
4544 !! test
4545 Section extraction test (section 5)
4546 !! options
4547 section=5
4548 !! input
4549 start
4550 ==a==
4551 ===aa===
4552 ====aaa====
4553 ==b==
4554 ===ba===
4555 ===bb===
4556 ====bba====
4557 ===bc===
4558 ==c==
4559 ===ca===
4560 !! result
4561 ===ba===
4562 !! end
4564 !! test
4565 Section extraction test (section 6)
4566 !! options
4567 section=6
4568 !! input
4569 start
4570 ==a==
4571 ===aa===
4572 ====aaa====
4573 ==b==
4574 ===ba===
4575 ===bb===
4576 ====bba====
4577 ===bc===
4578 ==c==
4579 ===ca===
4580 !! result
4581 ===bb===
4582 ====bba====
4583 !! end
4585 !! test
4586 Section extraction test (section 7)
4587 !! options
4588 section=7
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 ====bba====
4603 !! end
4605 !! test
4606 Section extraction test (section 8)
4607 !! options
4608 section=8
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 ===bc===
4623 !! end
4625 !! test
4626 Section extraction test (section 9)
4627 !! options
4628 section=9
4629 !! input
4630 start
4631 ==a==
4632 ===aa===
4633 ====aaa====
4634 ==b==
4635 ===ba===
4636 ===bb===
4637 ====bba====
4638 ===bc===
4639 ==c==
4640 ===ca===
4641 !! result
4642 ==c==
4643 ===ca===
4644 !! end
4646 !! test
4647 Section extraction test (section 10)
4648 !! options
4649 section=10
4650 !! input
4651 start
4652 ==a==
4653 ===aa===
4654 ====aaa====
4655 ==b==
4656 ===ba===
4657 ===bb===
4658 ====bba====
4659 ===bc===
4660 ==c==
4661 ===ca===
4662 !! result
4663 ===ca===
4664 !! end
4666 !! test
4667 Section extraction test (nonexistent section 11)
4668 !! options
4669 section=11
4670 !! input
4671 start
4672 ==a==
4673 ===aa===
4674 ====aaa====
4675 ==b==
4676 ===ba===
4677 ===bb===
4678 ====bba====
4679 ===bc===
4680 ==c==
4681 ===ca===
4682 !! result
4683 !! end
4685 !! test
4686 Section extraction test with bogus heading (section 1)
4687 !! options
4688 section=1
4689 !! input
4690 ==a==
4691 ==bogus== not a legal section
4692 ==b==
4693 !! result
4694 ==a==
4695 ==bogus== not a legal section
4696 !! end
4698 !! test
4699 Section extraction test with bogus heading (section 2)
4700 !! options
4701 section=2
4702 !! input
4703 ==a==
4704 ==bogus== not a legal section
4705 ==b==
4706 !! result
4707 ==b==
4708 !! end
4710 !! test
4711 Section extraction test with comment after heading (section 1)
4712 !! options
4713 section=1
4714 !! input
4715 ==a==
4716 ==legal== <!-- a legal section -->
4717 ==b==
4718 !! result
4719 ==a==
4720 !! end
4722 !! test
4723 Section extraction test with comment after heading (section 2)
4724 !! options
4725 section=2
4726 !! input
4727 ==a==
4728 ==legal== <!-- a legal section -->
4729 ==b==
4730 !! result
4731 ==legal== <!-- a legal section -->
4732 !! end
4734 !! test
4735 Section extraction test with bogus <nowiki> heading (section 1)
4736 !! options
4737 section=1
4738 !! input
4739 ==a==
4740 ==bogus== <nowiki>not a legal section</nowiki>
4741 ==b==
4742 !! result
4743 ==a==
4744 ==bogus== <nowiki>not a legal section</nowiki>
4745 !! end
4747 !! test
4748 Section extraction test with bogus <nowiki> heading (section 2)
4749 !! options
4750 section=2
4751 !! input
4752 ==a==
4753 ==bogus== <nowiki>not a legal section</nowiki>
4754 ==b==
4755 !! result
4756 ==b==
4757 !! end
4760 !! test
4761 Section extraction prefixed by comment (section 1) (bug 2587)
4762 !! options
4763 section=1
4764 !! input
4765 <!-- -->==sec1==
4766 ==sec2==
4767 !!result
4768 <!-- -->==sec1==
4769 !!end
4771 !! test
4772 Section extraction prefixed by comment (section 2) (bug 2587)
4773 !! options
4774 section=2
4775 !! input
4776 <!-- -->==sec1==
4777 ==sec2==
4778 !!result
4779 ==sec2==
4780 !!end
4783 !! test
4784 Section extraction, mixed wiki and html (section 1) (bug 2607)
4785 !! options
4786 section=1
4787 !! input
4788 <h2>1</h2>
4790 ==2==
4792 ==3==
4793 three
4794 !! result
4795 <h2>1</h2>
4797 !! end
4799 !! test
4800 Section extraction, mixed wiki and html (section 2) (bug 2607)
4801 !! options
4802 section=2
4803 !! input
4804 <h2>1</h2>
4806 ==2==
4808 ==3==
4809 three
4810 !! result
4811 ==2==
4813 !! end
4816 !! test
4817 Section extraction, heading surrounded by <noinclude> (bug 3342)
4818 !! options
4819 section=1
4820 !! input
4821 <noinclude>==a==</noinclude>
4822 text
4823 !! result
4824 <noinclude>==a==</noinclude>
4825 text
4826 !!end
4829 !! test
4830 Section extraction, HTML heading subsections (bug 5272)
4831 !! options
4832 section=1
4833 !! input
4834 <h2>a</h2>
4835 <h3>aa</h3>
4836 <h2>b</h2>
4837 !! result
4838 <h2>a</h2>
4839 <h3>aa</h3>
4840 !! end
4842 !! test
4843 Section extraction, HTML headings should be ignored in extensions (bug 3476)
4844 !! options
4845 section=2
4846 !! input
4847 <h2>a</h2>
4848 <tag>
4849 <h2>not b</h2>
4850 </tag>
4851 <h2>b</h2>
4852 !! result
4853 <h2>b</h2>
4854 !! end
4856 !! test
4857 Section replacement test (section 0)
4858 !! options
4859 replace=0,"xxx"
4860 !! input
4861 start
4862 ==a==
4863 ===aa===
4864 ====aaa====
4865 ==b==
4866 ===ba===
4867 ===bb===
4868 ====bba====
4869 ===bc===
4870 ==c==
4871 ===ca===
4872 !! result
4875 ==a==
4876 ===aa===
4877 ====aaa====
4878 ==b==
4879 ===ba===
4880 ===bb===
4881 ====bba====
4882 ===bc===
4883 ==c==
4884 ===ca===
4885 !! end
4887 !! test
4888 Section replacement test (section 1)
4889 !! options
4890 replace=1,"xxx"
4891 !! input
4892 start
4893 ==a==
4894 ===aa===
4895 ====aaa====
4896 ==b==
4897 ===ba===
4898 ===bb===
4899 ====bba====
4900 ===bc===
4901 ==c==
4902 ===ca===
4903 !! result
4904 start
4907 ==b==
4908 ===ba===
4909 ===bb===
4910 ====bba====
4911 ===bc===
4912 ==c==
4913 ===ca===
4914 !! end
4916 !! test
4917 Section replacement test (section 2)
4918 !! options
4919 replace=2,"xxx"
4920 !! input
4921 start
4922 ==a==
4923 ===aa===
4924 ====aaa====
4925 ==b==
4926 ===ba===
4927 ===bb===
4928 ====bba====
4929 ===bc===
4930 ==c==
4931 ===ca===
4932 !! result
4933 start
4934 ==a==
4937 ==b==
4938 ===ba===
4939 ===bb===
4940 ====bba====
4941 ===bc===
4942 ==c==
4943 ===ca===
4944 !! end
4946 !! test
4947 Section replacement test (section 3)
4948 !! options
4949 replace=3,"xxx"
4950 !! input
4951 start
4952 ==a==
4953 ===aa===
4954 ====aaa====
4955 ==b==
4956 ===ba===
4957 ===bb===
4958 ====bba====
4959 ===bc===
4960 ==c==
4961 ===ca===
4962 !! result
4963 start
4964 ==a==
4965 ===aa===
4968 ==b==
4969 ===ba===
4970 ===bb===
4971 ====bba====
4972 ===bc===
4973 ==c==
4974 ===ca===
4975 !! end
4977 !! test
4978 Section replacement test (section 4)
4979 !! options
4980 replace=4,"xxx"
4981 !! input
4982 start
4983 ==a==
4984 ===aa===
4985 ====aaa====
4986 ==b==
4987 ===ba===
4988 ===bb===
4989 ====bba====
4990 ===bc===
4991 ==c==
4992 ===ca===
4993 !! result
4994 start
4995 ==a==
4996 ===aa===
4997 ====aaa====
5000 ==c==
5001 ===ca===
5002 !! end
5004 !! test
5005 Section replacement test (section 5)
5006 !! options
5007 replace=5,"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
5021 start
5022 ==a==
5023 ===aa===
5024 ====aaa====
5025 ==b==
5028 ===bb===
5029 ====bba====
5030 ===bc===
5031 ==c==
5032 ===ca===
5033 !! end
5035 !! test
5036 Section replacement test (section 6)
5037 !! options
5038 replace=6,"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
5053 ==a==
5054 ===aa===
5055 ====aaa====
5056 ==b==
5057 ===ba===
5060 ===bc===
5061 ==c==
5062 ===ca===
5063 !! end
5065 !! test
5066 Section replacement test (section 7)
5067 !! options
5068 replace=7,"xxx"
5069 !! input
5070 start
5071 ==a==
5072 ===aa===
5073 ====aaa====
5074 ==b==
5075 ===ba===
5076 ===bb===
5077 ====bba====
5078 ===bc===
5079 ==c==
5080 ===ca===
5081 !! result
5082 start
5083 ==a==
5084 ===aa===
5085 ====aaa====
5086 ==b==
5087 ===ba===
5088 ===bb===
5091 ===bc===
5092 ==c==
5093 ===ca===
5094 !! end
5096 !! test
5097 Section replacement test (section 8)
5098 !! options
5099 replace=8,"xxx"
5100 !! input
5101 start
5102 ==a==
5103 ===aa===
5104 ====aaa====
5105 ==b==
5106 ===ba===
5107 ===bb===
5108 ====bba====
5109 ===bc===
5110 ==c==
5111 ===ca===
5112 !! result
5113 start
5114 ==a==
5115 ===aa===
5116 ====aaa====
5117 ==b==
5118 ===ba===
5119 ===bb===
5120 ====bba====
5123 ==c==
5124 ===ca===
5125 !!end
5127 !! test
5128 Section replacement test (section 9)
5129 !! options
5130 replace=9,"xxx"
5131 !! input
5132 start
5133 ==a==
5134 ===aa===
5135 ====aaa====
5136 ==b==
5137 ===ba===
5138 ===bb===
5139 ====bba====
5140 ===bc===
5141 ==c==
5142 ===ca===
5143 !! result
5144 start
5145 ==a==
5146 ===aa===
5147 ====aaa====
5148 ==b==
5149 ===ba===
5150 ===bb===
5151 ====bba====
5152 ===bc===
5154 !! end
5156 !! test
5157 Section replacement test (section 10)
5158 !! options
5159 replace=10,"xxx"
5160 !! input
5161 start
5162 ==a==
5163 ===aa===
5164 ====aaa====
5165 ==b==
5166 ===ba===
5167 ===bb===
5168 ====bba====
5169 ===bc===
5170 ==c==
5171 ===ca===
5172 !! result
5173 start
5174 ==a==
5175 ===aa===
5176 ====aaa====
5177 ==b==
5178 ===ba===
5179 ===bb===
5180 ====bba====
5181 ===bc===
5182 ==c==
5184 !! end
5187 !! test
5188 Section extraction, HTML headings not at line boundaries (section 0)
5189 !! options
5190 section=0
5191 !! input
5192 <h2>Evil</h2><i>blah blah blah</i>
5194 evil blah
5196 <h2>Nice</h2>
5198 nice blah
5200 <i>extra evil</i><h2>Extra nasty</h2>
5202 extra nasty
5203 !! result
5204 !! end
5206 !! test
5207 Section extraction, HTML headings not at line boundaries (section 1)
5208 !! options
5209 section=1
5210 !! input
5211 <h2>Evil</h2><i>blah blah blah</i>
5213 evil blah
5215 <h2>Nice</h2>
5217 nice blah
5219 <i>extra evil</i><h2>Extra nasty</h2>
5221 extra nasty
5222 !! result
5223 <h2>Evil</h2><i>blah blah blah</i>
5225 evil blah
5226 !! end
5228 !! test
5229 Section extraction, HTML headings not at line boundaries (section 2)
5230 !! options
5231 section=2
5232 !! input
5233 <h2>Evil</h2><i>blah blah blah</i>
5235 evil blah
5237 <h2>Nice</h2>
5239 nice blah
5241 <i>extra evil</i><h2>Extra nasty</h2>
5243 extra nasty
5244 !! result
5245 <h2>Nice</h2>
5247 nice blah
5249 <i>extra evil</i>
5250 !! end
5252 !! test
5253 Section extraction, HTML headings not at line boundaries (section 3)
5254 !! options
5255 section=3
5256 !! input
5257 <h2>Evil</h2><i>blah blah blah</i>
5259 evil blah
5261 <h2>Nice</h2>
5263 nice blah
5265 <i>extra evil</i><h2>Extra nasty</h2>
5267 extra nasty
5268 !! result
5269 <h2>Extra nasty</h2>
5271 extra nasty
5272 !! end
5278 TODO:
5279 more images
5280 more tables
5281 math
5282 character entities
5283 and much more