* (bug 6102) For consistency with other markup, normalize all HTML-encoded
[lhc/web/wiklou.git] / maintenance / parserTests.txt
1 # MediaWiki Parser test cases
2 # Some taken from http://meta.wikimedia.org/wiki/Parser_testing
3 # All (C) their respective authors and released under the GPL
4 #
5 # The syntax should be fairly self-explanatory.
6 #
7 # Currently supported test options:
8 # One of the following three:
9 #
10 # (default) generate HTML output
11 # pst apply pre-save transform
12 # msg apply message transform
13 #
14 # Plus any combination of these:
15 #
16 # cat add category links
17 # ill add inter-language links
18 # subpage enable subpages (disabled by default)
19 # noxml don't check for XML well formdness
20 # title=[[XXX]] run test using article title XXX
21 # language=XXX set content language to XXX for this test
22 # disabled do not run test
23 #
24 # For testing purposes, temporary articles can created:
25 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
26 # where '/' denotes a newline.
27
28 # This is the standard article assumed to exist.
29 !! article
30 Main Page
31 !! text
32 blah blah
33 !! endarticle
34
35 ###
36 ### Basic tests
37 ###
38 !! test
39 Blank input
40 !! input
41 !! result
42 !! end
43
44
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
53
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>
63
64 !! end
65
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>
99
100 !! end
101
102 ###
103 ### <nowiki> test cases
104 ###
105
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
114
115 !! test
116 <nowiki> spacing
117 !! input
118 <nowiki>Lorem ipsum dolor
119
120 sed abit.
121 sed nullum.
122
123 :and a colon
124 </nowiki>
125 !! result
126 <p>Lorem ipsum dolor
127
128 sed abit.
129 sed nullum.
130
131 :and a colon
132
133 </p>
134 !! end
135
136 !! test
137 nowiki 3
138 !! input
139 :There is not nowiki.
140 :There is <nowiki>nowiki</nowiki>.
141
142 #There is not nowiki.
143 #There is <nowiki>nowiki</nowiki>.
144
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>
157
158 !! end
159
160 ###
161 ### Comments
162 ###
163 !! test
164 Comment test 1
165 !! input
166 <!-- comment 1 --> asdf
167 <!-- comment 2 -->
168 !! result
169 <pre>asdf
170 </pre>
171
172 !! end
173
174 !! test
175 Comment test 2
176 !! input
177 asdf
178 <!-- comment 1 -->
179 jkl
180 !! result
181 <p>asdf
182 jkl
183 </p>
184 !! end
185
186 !! test
187 Comment test 3
188 !! input
189 asdf
190 <!-- comment 1 -->
191 <!-- comment 2 -->
192 jkl
193 !! result
194 <p>asdf
195 jkl
196 </p>
197 !! end
198
199 !! test
200 Comment test 4
201 !! input
202 asdf<!-- comment 1 -->jkl
203 !! result
204 <p>asdfjkl
205 </p>
206 !! end
207
208 !! test
209 Comment spacing
210 !! input
211 a
212 <!-- foo --> b <!-- bar -->
213 c
214 !! result
215 <p>a
216 </p>
217 <pre> b
218 </pre>
219 <p>c
220 </p>
221 !! end
222
223 !! test
224 Comment whitespace
225 !! input
226 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
227 !! result
228
229 !! end
230
231 !! test
232 Comment semantics and delimiters
233 !! input
234 <!-- --><!----><!-----><!------>
235 !! result
236
237 !! end
238
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
245
246 !! end
247
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
259
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
268
269
270 ###
271 ### Preformatted text
272 ###
273 !! test
274 Preformatted text
275 !! input
276 This is some
277 Preformatted text
278 With ''italic''
279 And '''bold'''
280 And a [[Main Page|link]]
281 !! result
282 <pre>This is some
283 Preformatted text
284 With <i>italic</i>
285 And <b>bold</b>
286 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
287 </pre>
288 !! end
289
290 ###
291 ### Definition lists
292 ###
293 !! test
294 Simple definition
295 !! input
296 ; name : Definition
297 !! result
298 <dl><dt> name&nbsp;</dt><dd> Definition
299 </dd></dl>
300
301 !! end
302
303 !! test
304 Simple definition
305 !! input
306 : Indented text
307 !! result
308 <dl><dd> Indented text
309 </dd></dl>
310
311 !! end
312
313 !! test
314 Definition list with no space
315 !! input
316 ;name:Definition
317 !! result
318 <dl><dt>name</dt><dd>Definition
319 </dd></dl>
320
321 !!end
322
323 !! test
324 Definition list with URL link
325 !! input
326 ; http://example.com/ : definition
327 !! result
328 <dl><dt> <a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
329 </dd></dl>
330
331 !! end
332
333 !! test
334 Definition list with bracketed URL link
335 !! input
336 ;[http://www.example.com/ Example]:Something about it
337 !! result
338 <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
339 </dd></dl>
340
341 !! end
342
343 !! test
344 Definition list with wikilink containing colon
345 !! input
346 ; [[Help:FAQ]]: The least-read page on Wikipedia
347 !! result
348 <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
349 </dd></dl>
350
351 !! end
352
353 # At Brion's and JeLuF's insistence... :)
354 !! test
355 Definition list with wikilink containing colon
356 !! input
357 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
358 !! result
359 <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!
360 </dd></dl>
361
362 !! end
363
364 !! test
365 Malformed definition list with colon
366 !! input
367 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
368 !! result
369 <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
370 </dt></dl>
371
372 !! end
373
374 !! test
375 Definition lists: colon in external link text
376 !! input
377 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
378 !! result
379 <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
380 </dd></dl>
381
382 !! end
383
384
385 ###
386 ### External links
387 ###
388 !! test
389 External links: non-bracketed
390 !! input
391 Non-bracketed: http://example.com
392 !! result
393 <p>Non-bracketed: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
394 </p>
395 !! end
396
397 !! test
398 External links: numbered
399 !! input
400 Numbered: [http://example.com]
401 Numbered: [http://example.net]
402 Numbered: [http://example.org]
403 !! result
404 <p>Numbered: <a href="http://example.com" class='external autonumber' title="http://example.com" rel="nofollow">[1]</a>
405 Numbered: <a href="http://example.net" class='external autonumber' title="http://example.net" rel="nofollow">[2]</a>
406 Numbered: <a href="http://example.org" class='external autonumber' title="http://example.org" rel="nofollow">[3]</a>
407 </p>
408 !!end
409
410 !! test
411 External links: specified text
412 !! input
413 Specified text: [http://example.com link]
414 !! result
415 <p>Specified text: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>
416 </p>
417 !!end
418
419 !! test
420 External links: trail
421 !! input
422 Linktrails should not work for external links: [http://example.com link]s
423 !! result
424 <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
425 </p>
426 !! end
427
428 !! test
429 External links: dollar sign in URL
430 !! input
431 http://example.com/1$2345
432 !! result
433 <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>
434 </p>
435 !! end
436
437 !! test
438 External links: dollar sign in URL (named)
439 !! input
440 [http://example.com/1$2345]
441 !! result
442 <p><a href="http://example.com/1$2345" class='external autonumber' title="http://example.com/1$2345" rel="nofollow">[1]</a>
443 </p>
444 !!end
445
446 !! test
447 External links: open square bracket forbidden in URL (bug 4377)
448 !! input
449 http://example.com/1[2345
450 !! result
451 <p><a href="http://example.com/1" class='external free' title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
452 </p>
453 !! end
454
455 !! test
456 External links: open square bracket forbidden in URL (named) (bug 4377)
457 !! input
458 [http://example.com/1[2345]
459 !! result
460 <p><a href="http://example.com/1" class='external text' title="http://example.com/1" rel="nofollow">[2345</a>
461 </p>
462 !!end
463
464 !! test
465 External image
466 !! input
467 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
468 !! result
469 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
470 </p>
471 !! end
472
473 !! test
474 External image from https
475 !! input
476 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
477 !! result
478 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
479 </p>
480 !! end
481
482 !! test
483 Link to non-http image, no img tag
484 !! input
485 Link to non-http image, no img tag: ftp://example.com/test.jpg
486 !! result
487 <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>
488 </p>
489 !! end
490
491 !! test
492 External links: terminating separator
493 !! input
494 Terminating separator: http://example.com/thing,
495 !! result
496 <p>Terminating separator: <a href="http://example.com/thing" class='external free' title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
497 </p>
498 !! end
499
500 !! test
501 External links: intervening separator
502 !! input
503 Intervening separator: http://example.com/1,2,3
504 !! result
505 <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>
506 </p>
507 !! end
508
509 !! test
510 External links: old bug with URL in query
511 !! input
512 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
513 !! result
514 <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>
515 </p>
516 !! end
517
518 !! test
519 External links: old URL-in-URL bug, mixed protocols
520 !! input
521 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
522 !! result
523 <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>
524 </p>
525 !!end
526
527 !! test
528 External links: URL in text
529 !! input
530 URL in text: [http://example.com http://example.com]
531 !! result
532 <p>URL in text: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
533 </p>
534 !! end
535
536 !! test
537 External links: Clickable images
538 !! input
539 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
540 !! result
541 <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>
542 </p>
543 !!end
544
545 !! test
546 External links: raw ampersand
547 !! input
548 Old &amp; use: http://x&y
549 !! result
550 <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>
551 </p>
552 !! end
553
554 !! test
555 External links: encoded ampersand
556 !! input
557 Old &amp; use: http://x&amp;y
558 !! result
559 <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>
560 </p>
561 !! end
562
563 !! test
564 External links: encoded equals (bug 6102)
565 !! input
566 http://example.com/?foo&#61;bar
567 !! result
568 <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>
569 </p>
570 !! end
571
572 !! test
573 External links: [raw ampersand]
574 !! input
575 Old &amp; use: [http://x&y]
576 !! result
577 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
578 </p>
579 !! end
580
581 !! test
582 External links: [encoded ampersand]
583 !! input
584 Old &amp; use: [http://x&amp;y]
585 !! result
586 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
587 </p>
588 !! end
589
590 !! test
591 External links: [encoded equals] (bug 6102)
592 !! input
593 [http://example.com/?foo&#61;bar]
594 !! result
595 <p><a href="http://example.com/?foo=bar" class='external autonumber' title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
596 </p>
597 !! end
598
599 !! test
600 External links: www.jpeg.org (bug 554)
601 !! input
602 http://www.jpeg.org
603 !!result
604 <p><a href="http://www.jpeg.org" class='external free' title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
605 </p>
606 !! end
607
608 !! test
609 External links: URL within URL (original bug 2)
610 !! input
611 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
612 !! result
613 <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>
614 </p>
615 !! end
616
617 !! test
618 BUG 361: URL inside bracketed URL
619 !! input
620 [http://www.example.com/foo http://www.example.com/bar]
621 !! result
622 <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>
623 </p>
624 !! end
625
626 !! test
627 BUG 361: URL within URL, not bracketed
628 !! input
629 http://www.example.com/foo?=http://www.example.com/bar
630 !! result
631 <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>
632 </p>
633 !! end
634
635 !! test
636 BUG 289: ">"-token in URL-tail
637 !! input
638 http://www.example.com/<hello>
639 !! result
640 <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;
641 </p>
642 !!end
643
644 !! test
645 BUG 289: literal ">"-token in URL-tail
646 !! input
647 http://www.example.com/<b>html</b>
648 !! result
649 <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>
650 </p>
651 !!end
652
653 !! test
654 BUG 289: ">"-token in bracketed URL
655 !! input
656 [http://www.example.com/<hello> stuff]
657 !! result
658 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
659 </p>
660 !!end
661
662 !! test
663 BUG 289: literal ">"-token in bracketed URL
664 !! input
665 [http://www.example.com/<b>html</b> stuff]
666 !! result
667 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
668 </p>
669 !!end
670
671 !! test
672 BUG 289: literal double quote at end of URL
673 !! input
674 http://www.example.com/"hello"
675 !! result
676 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
677 </p>
678 !!end
679
680 !! test
681 BUG 289: literal double quote in bracketed URL
682 !! input
683 [http://www.example.com/"hello" stuff]
684 !! result
685 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
686 </p>
687 !!end
688
689 !! test
690 External links: invalid character
691 Fixme: the missing char seems to have gone missing
692 !! options
693 disabled
694 !! input
695 [http://www.example.com test]
696 !! result
697 <p>[<a href="http://www.example.com" class='external free' title="http://www.example.com" rel="nofollow">http://www.example.com</a> test]
698 </p>
699 !! end
700
701 !! test
702 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
703 !! input
704 [http://www.example.com test]
705 !! result
706 <p><a href="http://www.example.com" class='external text' title="http://www.example.com" rel="nofollow">test</a>
707 </p>
708 !! end
709
710 !! test
711 External links: wiki links within external link (Bug 3695)
712 !! input
713 [http://example.com [[wikilink]] embedded in ext link]
714 !! result
715 <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>
716 </p>
717 !! end
718
719 !! test
720 BUG 787: Links with one slash after the url protocol are invalid
721 !! input
722 http:/example.com
723
724 [http:/example.com title]
725 !! result
726 <p>http:/example.com
727 </p><p>[http:/example.com title]
728 </p>
729 !! end
730
731 !! test
732 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
733 !! input
734 ''[http://example.com text'']
735 [http://example.com '''text]'''
736 ''Something [http://example.com in italic'']
737 ''Something [http://example.com mixed''''', even bold]'''
738 '''''Now [http://example.com both''''']
739 !! result
740 <p><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>text</i></a>
741 <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><b>text</b></a>
742 <i>Something </i><a href="http://example.com" class='external text' title="http://example.com" rel="nofollow"><i>in italic</i></a>
743 <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>
744 <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>
745 </p>
746 !! end
747
748
749 !! test
750 Bug 4781: %26 in URL
751 !! input
752 http://www.example.com/?title=AT%26T
753 !! result
754 <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>
755 </p>
756 !! end
757
758 !! test
759 Bug 4781, 5267: %26 in URL
760 !! input
761 http://www.example.com/?title=100%25_Bran
762 !! result
763 <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>
764 </p>
765 !! end
766
767 !! test
768 Bug 4781, 5267: %28, %29 in URL
769 !! input
770 http://www.example.com/?title=Ben-Hur_%281959_film%29
771 !! result
772 <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>
773 </p>
774 !! end
775
776
777 !! test
778 Bug 4781: %26 in autonumber URL
779 !! input
780 [http://www.example.com/?title=AT%26T]
781 !! result
782 <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>
783 </p>
784 !! end
785
786 !! test
787 Bug 4781, 5267: %26 in autonumber URL
788 !! input
789 [http://www.example.com/?title=100%25_Bran]
790 !! result
791 <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>
792 </p>
793 !! end
794
795 !! test
796 Bug 4781, 5267: %28, %29 in autonumber URL
797 !! input
798 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
799 !! result
800 <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>
801 </p>
802 !! end
803
804
805 !! test
806 Bug 4781: %26 in bracketed URL
807 !! input
808 [http://www.example.com/?title=AT%26T link]
809 !! result
810 <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>
811 </p>
812 !! end
813
814 !! test
815 Bug 4781, 5267: %26 in bracketed URL
816 !! input
817 [http://www.example.com/?title=100%25_Bran link]
818 !! result
819 <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>
820 </p>
821 !! end
822
823 !! test
824 Bug 4781, 5267: %28, %29 in bracketed URL
825 !! input
826 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
827 !! result
828 <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>
829 </p>
830 !! end
831
832
833 ###
834 ### Quotes
835 ###
836
837 !! test
838 Quotes
839 !! input
840 Normal text. '''Bold text.''' Normal text. ''Italic text.''
841
842 Normal text. '''''Bold italic text.''''' Normal text.
843 !!result
844 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
845 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
846 </p>
847 !! end
848
849
850 !! test
851 Unclosed and unmatched quotes
852 !! input
853 '''''Bold italic text '''with bold deactivated''' in between.'''''
854
855 '''''Bold italic text ''with italic deactivated'' in between.'''''
856
857 '''Bold text..
858
859 ..spanning two paragraphs (should not work).'''
860
861 '''Bold tag left open
862
863 ''Italic tag left open
864
865 Normal text.
866
867 <!-- Unmatching number of opening, closing tags: -->
868 '''This year''''s election ''should'' beat '''last year''''s.
869
870 ''Tom'''s car is bigger than ''Susan'''s.
871 !! result
872 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
873 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
874 </p><p><b>Bold text..</b>
875 </p><p>..spanning two paragraphs (should not work).
876 </p><p><b>Bold tag left open</b>
877 </p><p><i>Italic tag left open</i>
878 </p><p>Normal text.
879 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
880 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
881 </p>
882 !! end
883
884 ###
885 ### Tables
886 ###
887 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
888 ###
889
890 # This should not produce <table></table> as <table><tr><td></td></tr></table>
891 # is the bare minimun required by the spec, see:
892 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
893 !! test
894 A table with no data.
895 !! input
896 {||}
897 !! result
898 !! end
899
900 # A table with nothing but a caption is invalid XHTML, we might want to render
901 # this as <p>caption</p>
902 !! test
903 A table with nothing but a caption
904 !! input
905 {|
906 |+ caption
907 |}
908 !! result
909 <table>
910 <caption> caption
911 </caption><tr><td></td></tr></table>
912
913 !! end
914
915 !! test
916 Simple table
917 !! input
918 {|
919 | 1 || 2
920 |-
921 | 3 || 4
922 |}
923 !! result
924 <table>
925 <tr>
926 <td> 1 </td><td> 2
927 </td></tr>
928 <tr>
929 <td> 3 </td><td> 4
930 </td></tr></table>
931
932 !! end
933
934 !! test
935 Multiplication table
936 !! input
937 {| border="1" cellpadding="2"
938 |+Multiplication table
939 |-
940 ! &times; !! 1 !! 2 !! 3
941 |-
942 ! 1
943 | 1 || 2 || 3
944 |-
945 ! 2
946 | 2 || 4 || 6
947 |-
948 ! 3
949 | 3 || 6 || 9
950 |-
951 ! 4
952 | 4 || 8 || 12
953 |-
954 ! 5
955 | 5 || 10 || 15
956 |}
957 !! result
958 <table border="1" cellpadding="2">
959 <caption>Multiplication table
960 </caption>
961 <tr>
962 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
963 </th></tr>
964 <tr>
965 <th> 1
966 </th><td> 1 </td><td> 2 </td><td> 3
967 </td></tr>
968 <tr>
969 <th> 2
970 </th><td> 2 </td><td> 4 </td><td> 6
971 </td></tr>
972 <tr>
973 <th> 3
974 </th><td> 3 </td><td> 6 </td><td> 9
975 </td></tr>
976 <tr>
977 <th> 4
978 </th><td> 4 </td><td> 8 </td><td> 12
979 </td></tr>
980 <tr>
981 <th> 5
982 </th><td> 5 </td><td> 10 </td><td> 15
983 </td></tr></table>
984
985 !! end
986
987 !! test
988 Table rowspan
989 !! input
990 {| align=right border=1
991 | Cell 1, row 1
992 |rowspan=2| Cell 2, row 1 (and 2)
993 | Cell 3, row 1
994 |-
995 | Cell 1, row 2
996 | Cell 3, row 2
997 |}
998 !! result
999 <table align="right" border="1">
1000 <tr>
1001 <td> Cell 1, row 1
1002 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1003 </td><td> Cell 3, row 1
1004 </td></tr>
1005 <tr>
1006 <td> Cell 1, row 2
1007 </td><td> Cell 3, row 2
1008 </td></tr></table>
1009
1010 !! end
1011
1012 !! test
1013 Nested table
1014 !! input
1015 {| border=1
1016 | &alpha;
1017 |
1018 {| bgcolor=#ABCDEF border=2
1019 |nested
1020 |-
1021 |table
1022 |}
1023 |the original table again
1024 |}
1025 !! result
1026 <table border="1">
1027 <tr>
1028 <td> &alpha;
1029 </td><td>
1030 <table bgcolor="#ABCDEF" border="2">
1031 <tr>
1032 <td>nested
1033 </td></tr>
1034 <tr>
1035 <td>table
1036 </td></tr></table>
1037 </td><td>the original table again
1038 </td></tr></table>
1039
1040 !! end
1041
1042 !! test
1043 Invalid attributes in table cell (bug 1830)
1044 !! input
1045 {|
1046 |Cell:|broken
1047 |}
1048 !! result
1049 <table>
1050 <tr>
1051 <td>broken
1052 </td></tr></table>
1053
1054 !! end
1055
1056
1057 # FIXME: this one has incorrect tag nesting still.
1058 !! test
1059 Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)
1060 !! input
1061 {|
1062 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1063 !! result
1064 <table>
1065 <tr>
1066 <td><a href="ftp://|x||" class='external autonumber' title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
1067 </td>
1068 </tr>
1069 </table>
1070
1071 !! end
1072
1073
1074 ###
1075 ### Internal links
1076 ###
1077 !! test
1078 Plain link, capitalized
1079 !! input
1080 [[Main Page]]
1081 !! result
1082 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1083 </p>
1084 !! end
1085
1086 !! test
1087 Plain link, uncapitalized
1088 !! input
1089 [[main Page]]
1090 !! result
1091 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1092 </p>
1093 !! end
1094
1095 !! test
1096 Piped link
1097 !! input
1098 [[Main Page|The Main Page]]
1099 !! result
1100 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1101 </p>
1102 !! end
1103
1104 !! test
1105 Broken link
1106 !! input
1107 [[Zigzagzogzagzig]]
1108 !! result
1109 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
1110 </p>
1111 !! end
1112
1113 !! test
1114 Link with prefix
1115 !! input
1116 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1117 !! result
1118 <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>
1119 </p>
1120 !! end
1121
1122 !! test
1123 Link with suffix
1124 !! input
1125 [[Main Page]]xxx, [[Main Page]]XXX
1126 !! result
1127 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
1128 </p>
1129 !! end
1130
1131 !! test
1132 Link with 3 brackets
1133 !! input
1134 [[[main page]]]
1135 !! result
1136 <p>[[[main page]]]
1137 </p>
1138 !! end
1139
1140 !! test
1141 Piped link with 3 brackets
1142 !! input
1143 [[[main page|the main page]]]
1144 !! result
1145 <p>[[[main page|the main page]]]
1146 </p>
1147 !! end
1148
1149 !! test
1150 Link with multiple pipes
1151 !! input
1152 [[Main Page|The|Main|Page]]
1153 !! result
1154 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1155 </p>
1156 !! end
1157
1158 !! test
1159 Link to namespaces
1160 !! input
1161 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1162 !! result
1163 <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>
1164 </p>
1165 !! end
1166
1167 !! test
1168 Piped link to namespace
1169 !! input
1170 [[Meta:Disclaimers|The disclaimers]]
1171 !! result
1172 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
1173 </p>
1174 !! end
1175
1176 !! test
1177 Link containing }
1178 !! input
1179 [[Usually caused by a typo (oops}]]
1180 !! result
1181 <p>[[Usually caused by a typo (oops}]]
1182 </p>
1183 !! end
1184
1185 !! test
1186 Link containing % (not as a hex sequence)
1187 !! input
1188 [[7% Solution]]
1189 !! result
1190 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1191 </p>
1192 !! end
1193
1194 !! test
1195 Link containing % as a single hex sequence interpreted to char
1196 !! input
1197 [[7%25 Solution]]
1198 !! result
1199 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1200 </p>
1201 !!end
1202
1203 !! test
1204 Link containing % as a double hex sequence interpreted to hex sequence
1205 !! input
1206 [[7%2525 Solution]]
1207 !! result
1208 <p>[[7%2525 Solution]]
1209 </p>
1210 !!end
1211
1212 !! test
1213 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1214 Example for such a section: == < ==
1215 !! input
1216 [[%23%3c]][[%23%3e]]
1217 !! result
1218 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1219 </p>
1220 !! end
1221
1222 !! test
1223 Link containing "<#" and ">#" as a hex sequences
1224 !! input
1225 [[%3c%23]][[%3e%23]]
1226 !! result
1227 <p>[[%3c%23]][[%3e%23]]
1228 </p>
1229 !! end
1230
1231 !! test
1232 Plain link to URL
1233 !! input
1234 [[http://www.example.org]]
1235 !! result
1236 <p>[<a href="http://www.example.org" class='external autonumber' title="http://www.example.org" rel="nofollow">[1]</a>]
1237 </p>
1238 !! end
1239
1240 # I'm fairly sure the expected result here is wrong.
1241 # We want these to be URL links, not pseudo-pages with URLs for titles....
1242 # However the current output is also pretty screwy.
1243 #
1244 # ----
1245 # I'm changing it to match the current output--it arguably makes more
1246 # sense in the light of the test above. Old expected result was:
1247 #<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>
1248 #</p>
1249 # But I think this test is bordering on "garbage in, garbage out" anyway.
1250 # -- wtm
1251 !! test
1252 Piped link to URL
1253 !! input
1254 Piped link to URL: [[http://www.example.org|an example URL]]
1255 !! result
1256 <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>]
1257 </p>
1258 !! end
1259
1260 !! test
1261 BUG 2: [[page|http://url/]] should link to page, not http://url/
1262 !! input
1263 [[Main Page|http://url/]]
1264 !! result
1265 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1266 </p>
1267 !! end
1268
1269 !! test
1270 BUG 337: Escaped self-links should be bold
1271 !! options
1272 title=[[Bug462]]
1273 !! input
1274 [[Bu&#103;462]] [[Bug462]]
1275 !! result
1276 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1277 </p>
1278 !! end
1279
1280 !! test
1281 Self-link to section should not be bold
1282 !! options
1283 title=[[Main Page]]
1284 !! input
1285 [[Main Page#section]]
1286 !! result
1287 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1288 </p>
1289 !! end
1290
1291 !! test
1292 <nowiki> inside a link
1293 !! input
1294 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1295 !! result
1296 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1297 </p>
1298 !! end
1299
1300 ###
1301 ### Interwiki links (see maintenance/interwiki.sql)
1302 ###
1303
1304 !! test
1305 Inline interwiki link
1306 !! input
1307 [[MeatBall:SoftSecurity]]
1308 !! result
1309 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1310 </p>
1311 !! end
1312
1313 !! test
1314 Inline interwiki link with empty title (bug 2372)
1315 !! input
1316 [[MeatBall:]]
1317 !! result
1318 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class='extiw' title="meatball:">MeatBall:</a>
1319 </p>
1320 !! end
1321
1322 !! test
1323 Interwiki link encoding conversion (bug 1636)
1324 !! input
1325 *[[Wikipedia:ro:Olteni&#0355;a]]
1326 *[[Wikipedia:ro:Olteni&#355;a]]
1327 !! result
1328 <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>
1329 </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>
1330 </li></ul>
1331
1332 !! end
1333
1334 !! test
1335 Interwiki link with fragment (bug 2130)
1336 !! input
1337 [[MeatBall:SoftSecurity#foo]]
1338 !! result
1339 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class='extiw' title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1340 </p>
1341 !! end
1342
1343 ##
1344 ## XHTML tidiness
1345 ###
1346
1347 !! test
1348 <br> to <br />
1349 !! input
1350 1<br>2<br />3
1351 !! result
1352 <p>1<br />2<br />3
1353 </p>
1354 !! end
1355
1356 !! test
1357 Incorrecly removing closing slashes from correctly formed XHTML
1358 !! input
1359 <br style="clear:both;" />
1360 !! result
1361 <p><br style="clear:both;" />
1362 </p>
1363 !! end
1364
1365 !! test
1366 Failing to transform badly formed HTML into correct XHTML
1367 !! input
1368 <br clear=left>
1369 <br clear=right>
1370 <br clear=all>
1371 !! result
1372 <p><br clear="left" />
1373 <br clear="right" />
1374 <br clear="all" />
1375 </p>
1376 !!end
1377
1378 !! test
1379 Horizontal ruler (should it add that extra space?)
1380 !! input
1381 <hr>
1382 <hr >
1383 foo <hr
1384 > bar
1385 !! result
1386 <hr />
1387 <hr />
1388 foo <hr /> bar
1389
1390 !! end
1391
1392 ###
1393 ### Block-level elements
1394 ###
1395 !! test
1396 Common list
1397 !! input
1398 *Common list
1399 * item 2
1400 *item 3
1401 !! result
1402 <ul><li>Common list
1403 </li><li> item 2
1404 </li><li>item 3
1405 </li></ul>
1406
1407 !! end
1408
1409 !! test
1410 Numbered list
1411 !! input
1412 #Numbered list
1413 #item 2
1414 # item 3
1415 !! result
1416 <ol><li>Numbered list
1417 </li><li>item 2
1418 </li><li> item 3
1419 </li></ol>
1420
1421 !! end
1422
1423 !! test
1424 Mixed list
1425 !! input
1426 *Mixed list
1427 *# with numbers
1428 ** and bullets
1429 *# and numbers
1430 *bullets again
1431 **bullet level 2
1432 ***bullet level 3
1433 ***#Number on level 4
1434 **bullet level 2
1435 **#Number on level 3
1436 **#Number on level 3
1437 *#number level 2
1438 *Level 1
1439 !! result
1440 <ul><li>Mixed list
1441 <ol><li> with numbers
1442 </li></ol>
1443 <ul><li> and bullets
1444 </li></ul>
1445 <ol><li> and numbers
1446 </li></ol>
1447 </li><li>bullets again
1448 <ul><li>bullet level 2
1449 <ul><li>bullet level 3
1450 <ol><li>Number on level 4
1451 </li></ol>
1452 </li></ul>
1453 </li><li>bullet level 2
1454 <ol><li>Number on level 3
1455 </li><li>Number on level 3
1456 </li></ol>
1457 </li></ul>
1458 <ol><li>number level 2
1459 </li></ol>
1460 </li><li>Level 1
1461 </li></ul>
1462
1463 !! end
1464
1465 !! test
1466 List items are not parsed correctly following a <pre> block (bug 785)
1467 !! input
1468 * <pre>foo</pre>
1469 * <pre>bar</pre>
1470 * zar
1471 !! result
1472 <ul><li> <pre>foo</pre>
1473 </li><li> <pre>bar</pre>
1474 </li><li> zar
1475 </li></ul>
1476
1477 !! end
1478
1479 ###
1480 ### Magic Words
1481 ###
1482
1483 !! test
1484 Magic Word: {{CURRENTDAY}}
1485 !! input
1486 {{CURRENTDAY}}
1487 !! result
1488 <p>1
1489 </p>
1490 !! end
1491
1492 !! test
1493 Magic Word: {{CURRENTDAY2}}
1494 !! input
1495 {{CURRENTDAY2}}
1496 !! result
1497 <p>01
1498 </p>
1499 !! end
1500
1501 !! test
1502 Magic Word: {{CURRENTDAYNAME}}
1503 !! input
1504 {{CURRENTDAYNAME}}
1505 !! result
1506 <p>Thursday
1507 </p>
1508 !! end
1509
1510 !! test
1511 Magic Word: {{CURRENTDOW}}
1512 !! input
1513 {{CURRENTDOW}}
1514 !! result
1515 <p>4
1516 </p>
1517 !! end
1518
1519 !! test
1520 Magic Word: {{CURRENTMONTH}}
1521 !! input
1522 {{CURRENTMONTH}}
1523 !! result
1524 <p>01
1525 </p>
1526 !! end
1527
1528 !! test
1529 Magic Word: {{CURRENTMONTHABBREV}}
1530 !! input
1531 {{CURRENTMONTHABBREV}}
1532 !! result
1533 <p>Jan
1534 </p>
1535 !! end
1536
1537 !! test
1538 Magic Word: {{CURRENTMONTHNAME}}
1539 !! input
1540 {{CURRENTMONTHNAME}}
1541 !! result
1542 <p>January
1543 </p>
1544 !! end
1545
1546 !! test
1547 Magic Word: {{CURRENTMONTHNAMEGEN}}
1548 !! input
1549 {{CURRENTMONTHNAMEGEN}}
1550 !! result
1551 <p>January
1552 </p>
1553 !! end
1554
1555 !! test
1556 Magic Word: {{CURRENTTIME}}
1557 !! input
1558 {{CURRENTTIME}}
1559 !! result
1560 <p>00:02
1561 </p>
1562 !! end
1563
1564 !! test
1565 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1566 !! input
1567 {{CURRENTWEEK}}
1568 !! result
1569 <p>1
1570 </p>
1571 !! end
1572
1573 !! test
1574 Magic Word: {{CURRENTYEAR}}
1575 !! input
1576 {{CURRENTYEAR}}
1577 !! result
1578 <p>1970
1579 </p>
1580 !! end
1581
1582 !! test
1583 Magic Word: {{FULLPAGENAME}}
1584 !! options
1585 title=[[User:Ævar Arnfjörð Bjarmason]]
1586 !! input
1587 {{FULLPAGENAME}}
1588 !! result
1589 <p>User:Ævar Arnfjörð Bjarmason
1590 </p>
1591 !! end
1592
1593 !! test
1594 Magic Word: {{FULLPAGENAMEE}}
1595 !! options
1596 title=[[User:Ævar Arnfjörð Bjarmason]]
1597 !! input
1598 {{FULLPAGENAMEE}}
1599 !! result
1600 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1601 </p>
1602 !! end
1603
1604 !! test
1605 Magic Word: {{NAMESPACE}}
1606 !! options
1607 title=[[User:Ævar Arnfjörð Bjarmason]]
1608 disabled # FIXME
1609 !! input
1610 {{NAMESPACE}}
1611 !! result
1612 <p>User
1613 </p>
1614 !! end
1615
1616 !! test
1617 Magic Word: {{NAMESPACEE}}
1618 !! options
1619 title=[[User:Ævar Arnfjörð Bjarmason]]
1620 disabled # FIXME
1621 !! input
1622 {{NAMESPACEE}}
1623 !! result
1624 <p>User
1625 </p>
1626 !! end
1627
1628 !! test
1629 Magic Word: {{NUMBEROFARTICLES}}
1630 !! input
1631 {{NUMBEROFARTICLES}}
1632 !! result
1633 <p>1
1634 </p>
1635 !! end
1636
1637 !! test
1638 Magic Word: {{NUMBEROFFILES}}
1639 !! input
1640 {{NUMBEROFFILES}}
1641 !! result
1642 <p>1
1643 </p>
1644 !! end
1645
1646 !! test
1647 Magic Word: {{PAGENAME}}
1648 !! options
1649 title=[[User:Ævar Arnfjörð Bjarmason]]
1650 disabled # FIXME
1651 !! input
1652 {{PAGENAME}}
1653 !! result
1654 <p>Ævar Arnfjörð Bjarmason
1655 </p>
1656 !! end
1657
1658 !! test
1659 Magic Word: {{PAGENAMEE}}
1660 !! options
1661 title=[[User:Ævar Arnfjörð Bjarmason]]
1662 !! input
1663 {{PAGENAMEE}}
1664 !! result
1665 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1666 </p>
1667 !! end
1668
1669 !! test
1670 Magic Word: {{REVISIONID}}
1671 !! input
1672 {{REVISIONID}}
1673 !! result
1674 <p>1337
1675 </p>
1676 !! end
1677
1678 !! test
1679 Magic Word: {{SCRIPTPATH}}
1680 !! input
1681 {{SCRIPTPATH}}
1682 !! result
1683 <p>/
1684 </p>
1685 !! end
1686
1687 !! test
1688 Magic Word: {{SERVER}}
1689 !! input
1690 {{SERVER}}
1691 !! result
1692 <p><a href="http://localhost" class='external free' title="http://localhost" rel="nofollow">http://localhost</a>
1693 </p>
1694 !! end
1695
1696 !! test
1697 Magic Word: {{SERVERNAME}}
1698 !! input
1699 {{SERVERNAME}}
1700 !! result
1701 <p>Britney Spears
1702 </p>
1703 !! end
1704
1705 !! test
1706 Magic Word: {{SITENAME}}
1707 !! input
1708 {{SITENAME}}
1709 !! result
1710 <p>MediaWiki
1711 </p>
1712 !! end
1713
1714 !! test
1715 Namespace 1 {{ns:1}}
1716 !! input
1717 {{ns:1}}
1718 !! result
1719 <p>Talk
1720 </p>
1721 !! end
1722
1723 !! test
1724 Namespace 1 {{ns:01}}
1725 !! input
1726 {{ns:01}}
1727 !! result
1728 <p>Talk
1729 </p>
1730 !! end
1731
1732 !! test
1733 Namespace 0 {{ns:0}} (bug 4783)
1734 !! input
1735 {{ns:0}}
1736 !! result
1737
1738 !! end
1739
1740 !! test
1741 Namespace 0 {{ns:00}} (bug 4783)
1742 !! input
1743 {{ns:00}}
1744 !! result
1745
1746 !! end
1747
1748 !! test
1749 Namespace -1 {{ns:-1}}
1750 !! input
1751 {{ns:-1}}
1752 !! result
1753 <p>Special
1754 </p>
1755 !! end
1756
1757 !! test
1758 Namespace Project {{ns:User}}
1759 !! input
1760 {{ns:User}}
1761 !! result
1762 <p>User
1763 </p>
1764 !! end
1765
1766
1767 ###
1768 ### Magic links
1769 ###
1770 !! test
1771 Magic links: internal link to RFC (bug 479)
1772 !! input
1773 [[RFC 123]]
1774 !! result
1775 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1776 </p>
1777 !! end
1778
1779 !! test
1780 Magic links: RFC (bug 479)
1781 !! input
1782 RFC 822
1783 !! result
1784 <p><a href='http://www.ietf.org/rfc/rfc822.txt' class='external' title="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a>
1785 </p>
1786 !! end
1787
1788 !! test
1789 Magic links: ISBN (bug 1937)
1790 !! input
1791 ISBN 0-306-40615-2
1792 !! result
1793 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1794 </p>
1795 !! end
1796
1797 !! test
1798 Magic links: PMID incorrectly converts space to underscore
1799 !! input
1800 PMID 1234
1801 !! result
1802 <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>
1803 </p>
1804 !! end
1805
1806 ###
1807 ### Templates
1808 ####
1809
1810 !! test
1811 Nonexistant template
1812 !! input
1813 {{thistemplatedoesnotexist}}
1814 !! result
1815 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1816 </p>
1817 !! end
1818
1819 !! article
1820 Template:test
1821 !! text
1822 This is a test template
1823 !! endarticle
1824
1825 !! test
1826 Simple template
1827 !! input
1828 {{test}}
1829 !! result
1830 <p>This is a test template
1831 </p>
1832 !! end
1833
1834 !! test
1835 Template with explicit namespace
1836 !! input
1837 {{Template:test}}
1838 !! result
1839 <p>This is a test template
1840 </p>
1841 !! end
1842
1843
1844 !! article
1845 Template:paramtest
1846 !! text
1847 This is a test template with parameter {{{param}}}
1848 !! endarticle
1849
1850 !! test
1851 Template parameter
1852 !! input
1853 {{paramtest|param=foo}}
1854 !! result
1855 <p>This is a test template with parameter foo
1856 </p>
1857 !! end
1858
1859 !! article
1860 Template:paramtestnum
1861 !! text
1862 [[{{{1}}}|{{{2}}}]]
1863 !! endarticle
1864
1865 !! test
1866 Template unnamed parameter
1867 !! input
1868 {{paramtestnum|Main Page|the main page}}
1869 !! result
1870 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
1871 </p>
1872 !! end
1873
1874 !! article
1875 Template:templatesimple
1876 !! text
1877 (test)
1878 !! endarticle
1879
1880 !! article
1881 Template:templateredirect
1882 !! text
1883 #redirect [[Template:templatesimple]]
1884 !! endarticle
1885
1886 !! article
1887 Template:templateasargtestnum
1888 !! text
1889 {{{{{1}}}}}
1890 !! endarticle
1891
1892 !! article
1893 Template:templateasargtest
1894 !! text
1895 {{template{{{templ}}}}}
1896 !! endarticle
1897
1898 !! article
1899 Template:templateasargtest2
1900 !! text
1901 {{{{{templ}}}}}
1902 !! endarticle
1903
1904 !! test
1905 Template with template name as unnamed argument
1906 !! input
1907 {{templateasargtestnum|templatesimple}}
1908 !! result
1909 <p>(test)
1910 </p>
1911 !! end
1912
1913 !! test
1914 Template with template name as argument
1915 !! input
1916 {{templateasargtest|templ=simple}}
1917 !! result
1918 <p>(test)
1919 </p>
1920 !! end
1921
1922 !! test
1923 Template with template name as argument (2)
1924 !! input
1925 {{templateasargtest2|templ=templatesimple}}
1926 !! result
1927 <p>(test)
1928 </p>
1929 !! end
1930
1931 !! article
1932 Template:templateasargtestdefault
1933 !! text
1934 {{{{{templ|templatesimple}}}}}
1935 !! endarticle
1936
1937 !! article
1938 Template:templa
1939 !! text
1940 '''templ'''
1941 !! endarticle
1942
1943 !! test
1944 Template with default value
1945 !! input
1946 {{templateasargtestdefault}}
1947 !! result
1948 <p>(test)
1949 </p>
1950 !! end
1951
1952 !! test
1953 Template with default value (value set)
1954 !! input
1955 {{templateasargtestdefault|templ=templa}}
1956 !! result
1957 <p><b>templ</b>
1958 </p>
1959 !! end
1960
1961 !! test
1962 Template redirect
1963 !! input
1964 {{templateredirect}}
1965 !! result
1966 <p>(test)
1967 </p>
1968 !! end
1969
1970 !! test
1971 Template with argument in separate line
1972 !! input
1973 {{ templateasargtest |
1974 templ = simple }}
1975 !! result
1976 <p>(test)
1977 </p>
1978 !! end
1979
1980 !! test
1981 Template with complex template as argument
1982 !! input
1983 {{paramtest|
1984 param ={{ templateasargtest |
1985 templ = simple }}}}
1986 !! result
1987 <p>This is a test template with parameter (test)
1988 </p>
1989 !! end
1990
1991 !! test
1992 Template with thumb image (wiht link in description)
1993 !! input
1994 {{paramtest|
1995 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
1996 !! result
1997 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>
1998
1999 !! end
2000
2001 !! article
2002 Template:complextemplate
2003 !! text
2004 {{{1}}} {{paramtest|
2005 param ={{{param}}}}}
2006 !! endarticle
2007
2008 !! test
2009 Template with complex arguments
2010 !! input
2011 {{complextemplate|
2012 param ={{ templateasargtest |
2013 templ = simple }}|[[Template:complextemplate|link]]}}
2014 !! result
2015 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2016 </p>
2017 !! end
2018
2019 !! test
2020 BUG 553: link with two variables in a piped link
2021 !! input
2022 {|
2023 |[[{{{1}}}|{{{2}}}]]
2024 |}
2025 !! result
2026 <table>
2027 <tr>
2028 <td>[[{{{1}}}|{{{2}}}]]
2029 </td></tr></table>
2030
2031 !! end
2032
2033 !! test
2034 Magic variable as template parameter
2035 !! input
2036 {{paramtest|param={{SITENAME}}}}
2037 !! result
2038 <p>This is a test template with parameter MediaWiki
2039 </p>
2040 !! end
2041
2042 !! article
2043 Template:linktest
2044 !! text
2045 [[{{{param}}}|link]]
2046 !! endarticle
2047
2048 !! test
2049 Template parameter as link source
2050 !! input
2051 {{linktest|param=Main Page}}
2052 !! result
2053 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2054 </p>
2055 !! end
2056
2057
2058 !!article
2059 Template:paramtest2
2060 !! text
2061 including another template, {{paramtest|param={{{arg}}}}}
2062 !! endarticle
2063
2064 !! test
2065 Template passing argument to another template
2066 !! input
2067 {{paramtest2|arg='hmm'}}
2068 !! result
2069 <p>including another template, This is a test template with parameter 'hmm'
2070 </p>
2071 !! end
2072
2073 !! article
2074 Template:Linktest2
2075 !! text
2076 Main Page
2077 !! endarticle
2078
2079 !! test
2080 Template as link source
2081 !! input
2082 [[{{linktest2}}]]
2083 !! result
2084 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2085 </p>
2086 !! end
2087
2088
2089 !! article
2090 Template:loop1
2091 !! text
2092 {{loop2}}
2093 !! endarticle
2094
2095 !! article
2096 Template:loop2
2097 !! text
2098 {{loop1}}
2099 !! endarticle
2100
2101 !! test
2102 Template infinite loop
2103 !! input
2104 {{loop1}}
2105 !! result
2106 <p>{{loop1}}<!-- WARNING: template loop detected -->
2107 </p>
2108 !! end
2109
2110 !! test
2111 Template from main namespace
2112 !! input
2113 {{:Main Page}}
2114 !! result
2115 <p>blah blah
2116 </p>
2117 !! end
2118
2119 !! article
2120 Template:table
2121 !! text
2122 {|
2123 | 1 || 2
2124 |-
2125 | 3 || 4
2126 |}
2127 !! endarticle
2128
2129 !! test
2130 BUG 529: Template with table, not included at beginning of line
2131 !! input
2132 foo {{table}}
2133 !! result
2134 <p>foo
2135 </p>
2136 <table>
2137 <tr>
2138 <td> 1 </td><td> 2
2139 </td></tr>
2140 <tr>
2141 <td> 3 </td><td> 4
2142 </td></tr></table>
2143
2144 !! end
2145
2146 !! test
2147 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2148 !! input
2149 foo
2150 {{table}}
2151 !! result
2152 <p>foo
2153 </p>
2154 <table>
2155 <tr>
2156 <td> 1 </td><td> 2
2157 </td></tr>
2158 <tr>
2159 <td> 3 </td><td> 4
2160 </td></tr></table>
2161
2162 !! end
2163
2164 !! test
2165 BUG 41: Template parameters shown as broken links
2166 !! input
2167 {{{parameter}}}
2168 !! result
2169 <p>{{{parameter}}}
2170 </p>
2171 !! end
2172
2173
2174 !! article
2175 Template:MSGNW test
2176 !! text
2177 ''None'' of '''this''' should be
2178 * interepreted
2179 but rather passed unmodified
2180 {{test}}
2181 !! endarticle
2182
2183 # hmm, fix this or just deprecate msgnw and document its behavior?
2184 !! test
2185 msgnw keyword
2186 !! options
2187 disabled
2188 !! input
2189 {{msgnw:MSGNW test}}
2190 !! result
2191 <p>''None'' of '''this''' should be
2192 * interepreted
2193 but rather passed unmodified
2194 {{test}}
2195 </p>
2196 !! end
2197
2198 !! test
2199 int keyword
2200 !! input
2201 {{int:youhavenewmessages|lots of money|not!}}
2202 !! result
2203 <p>You have lots of money (not!).
2204 </p>
2205 !! end
2206
2207 !! article
2208 Template:Includes
2209 !! text
2210 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2211 !! endarticle
2212
2213 !! test
2214 <includeonly> and <noinclude> being included
2215 !! input
2216 {{Includes}}
2217 !! result
2218 <p>Foobar
2219 </p>
2220 !! end
2221
2222 !! article
2223 Template:Includes2
2224 !! text
2225 <onlyinclude>Foo</onlyinclude>bar
2226 !! endarticle
2227
2228 !! test
2229 <onlyinclude> being included
2230 !! input
2231 {{Includes2}}
2232 !! result
2233 <p>Foo
2234 </p>
2235 !! end
2236
2237
2238 !! article
2239 Template:Includes3
2240 !! text
2241 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2242 !! endarticle
2243
2244 !! test
2245 <onlyinclude> and <includeonly> being included
2246 !! input
2247 {{Includes3}}
2248 !! result
2249 <p>Foo
2250 </p>
2251 !! end
2252
2253 !! test
2254 <includeonly> and <noinclude> on a page
2255 !! input
2256 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2257 !! result
2258 <p>Foozar
2259 </p>
2260 !! end
2261
2262 !! test
2263 <onlyinclude> on a page
2264 !! input
2265 <onlyinclude>Foo</onlyinclude>bar
2266 !! result
2267 <p>Foobar
2268 </p>
2269 !! end
2270
2271 ###
2272 ### Pre-save transform tests
2273 ###
2274 !! test
2275 pre-save transform: subst:
2276 !! options
2277 PST
2278 !! input
2279 {{subst:test}}
2280 !! result
2281 This is a test template
2282 !! end
2283
2284 !! test
2285 pre-save transform: normal template
2286 !! options
2287 PST
2288 !! input
2289 {{test}}
2290 !! result
2291 {{test}}
2292 !! end
2293
2294 !! test
2295 pre-save transform: nonexistant template
2296 !! options
2297 PST
2298 !! input
2299 {{thistemplatedoesnotexist}}
2300 !! result
2301 {{thistemplatedoesnotexist}}
2302 !! end
2303
2304
2305 !! test
2306 pre-save transform: subst magic variables
2307 !! options
2308 PST
2309 !! input
2310 {{subst:SITENAME}}
2311 !! result
2312 MediaWiki
2313 !! end
2314
2315 # This is bug 89, which I fixed. -- wtm
2316 !! test
2317 pre-save transform: subst: templates with parameters
2318 !! options
2319 pst
2320 !! input
2321 {{subst:paramtest|param="something else"}}
2322 !! result
2323 This is a test template with parameter "something else"
2324 !! end
2325
2326 !! article
2327 Template:nowikitest
2328 !! text
2329 <nowiki>'''not wiki'''</nowiki>
2330 !! endarticle
2331
2332 !! test
2333 pre-save transform: nowiki in subst (bug 1188)
2334 !! options
2335 pst
2336 !! input
2337 {{subst:nowikitest}}
2338 !! result
2339 <nowiki>'''not wiki'''</nowiki>
2340 !! end
2341
2342
2343 !! article
2344 Template:commenttest
2345 !! text
2346 This template has <!-- a comment --> in it.
2347 !! endarticle
2348
2349 !! test
2350 pre-save transform: comment in subst (bug 1936)
2351 !! options
2352 pst
2353 !! input
2354 {{subst:commenttest}}
2355 !! result
2356 This template has <!-- a comment --> in it.
2357 !! end
2358
2359
2360 !! article
2361 Template:dangerous
2362 !!text
2363 <span onmouseover="alert('crap')">Oh no</span>
2364 !!endarticle
2365
2366 !!test
2367 (confirming safety of fix for subst bug 1936)
2368 !! input
2369 {{Template:dangerous}}
2370 !! result
2371 <p><span>Oh no</span>
2372 </p>
2373 !! end
2374
2375 !! test
2376 pre-save transform: comment containing gallery (bug 5024)
2377 !! options
2378 pst
2379 !! input
2380 <!-- <gallery>data</gallery> -->
2381 !!result
2382 <!-- <gallery>data</gallery> -->
2383 !!end
2384
2385 !! test
2386 pre-save transform: comment containing extension
2387 !! options
2388 pst
2389 !! input
2390 <!-- <tag>data</tag> -->
2391 !!result
2392 <!-- <tag>data</tag> -->
2393 !!end
2394
2395 !! test
2396 pre-save transform: comment containing nowiki
2397 !! options
2398 pst
2399 !! input
2400 <!-- <nowiki>data</nowiki> -->
2401 !!result
2402 <!-- <nowiki>data</nowiki> -->
2403 !!end
2404
2405 !! test
2406 pre-save transform: comment containing math
2407 !! options
2408 pst
2409 !! input
2410 <!-- <math>data</math> -->
2411 !!result
2412 <!-- <math>data</math> -->
2413 !!end
2414
2415
2416 ###
2417 ### Message transform tests
2418 ###
2419 !! test
2420 message transform: magic variables
2421 !! options
2422 msg
2423 !! input
2424 {{SITENAME}}
2425 !! result
2426 MediaWiki
2427 !! end
2428
2429 !! test
2430 message transform: should not transform wiki markup
2431 !! options
2432 msg
2433 !! input
2434 ''test''
2435 !! result
2436 ''test''
2437 !! end
2438
2439 ###
2440 ### Images
2441 ###
2442 !! test
2443 Simple image
2444 !! input
2445 [[Image:foobar.jpg]]
2446 !! result
2447 <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>
2448 </p>
2449 !! end
2450
2451 !! test
2452 Right-aligned image
2453 !! input
2454 [[Image:foobar.jpg|right]]
2455 !! result
2456 <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>
2457
2458 !! end
2459
2460 !! test
2461 Image with caption
2462 !! input
2463 [[Image:foobar.jpg|right|Caption text]]
2464 !! result
2465 <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>
2466
2467 !! end
2468
2469 !! test
2470 Image with frame and link
2471 !! input
2472 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2473 !! result
2474 <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>
2475
2476 !! end
2477
2478 !! test
2479 Link to image page- image page normally doesn't exists, hence edit link
2480 TODO: Add test with existing image page
2481 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2482 !! input
2483 [[:Image:test]]
2484 !! result
2485 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2486 </p>
2487 !! end
2488
2489 !! test
2490 Frameless image caption with a free URL
2491 !! input
2492 [[Image:foobar.jpg|http://example.com]]
2493 !! result
2494 <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>
2495 </p>
2496 !! end
2497
2498 !! test
2499 Thumbnail image caption with a free URL
2500 !! input
2501 [[Image:foobar.jpg|thumb|http://example.com]]
2502 !! result
2503 <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>
2504
2505 !! end
2506
2507 !! test
2508 BUG 1887: A ISBN with a thumbnail
2509 !! input
2510 [[Image:foobar.jpg|thumb|ISBN 12354]]
2511 !! result
2512 <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>
2513
2514 !! end
2515
2516 !! test
2517 BUG 1887: A RFC with a thumbnail
2518 !! input
2519 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2520 !! result
2521 <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>
2522
2523 !! end
2524
2525 !! test
2526 BUG 1887: A mailto link with a thumbnail
2527 !! input
2528 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2529 !! result
2530 <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>
2531
2532 !! end
2533
2534 !! test
2535 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2536 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2537 !! input
2538 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2539 !! result
2540 <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>
2541
2542 !! end
2543
2544 !! test
2545 BUG 1887, part 2: A <math> with a thumbnail- math enabled
2546 !! options
2547 math
2548 !! input
2549 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2550 !! result
2551 <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>
2552
2553 !! end
2554
2555 # Pending resolution to bug 368
2556 !! test
2557 BUG 648: Frameless image caption with a link
2558 !! input
2559 [[Image:foobar.jpg|text with a [[link]] in it]]
2560 !! result
2561 <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>
2562 </p>
2563 !! end
2564
2565 !! test
2566 BUG 648: Frameless image caption with a link (suffix)
2567 !! input
2568 [[Image:foobar.jpg|text with a [[link]]foo in it]]
2569 !! result
2570 <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>
2571 </p>
2572 !! end
2573
2574 !! test
2575 BUG 648: Frameless image caption with an interwiki link
2576 !! input
2577 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
2578 !! result
2579 <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>
2580 </p>
2581 !! end
2582
2583 !! test
2584 BUG 648: Frameless image caption with a piped interwiki link
2585 !! input
2586 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
2587 !! result
2588 <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>
2589 </p>
2590 !! end
2591
2592 !! test
2593 Escape HTML special chars in image alt text
2594 !! input
2595 [[Image:foobar.jpg|& < > "]]
2596 !! result
2597 <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>
2598 </p>
2599 !! end
2600
2601 !! test
2602 BUG 499: Alt text should have &#1234;, not &amp;1234;
2603 !! input
2604 [[Image:foobar.jpg|&#9792;]]
2605 !! result
2606 <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>
2607 </p>
2608 !! end
2609
2610 !! test
2611 Broken image caption with link
2612 !! input
2613 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
2614 !! result
2615 <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.
2616 </p>
2617 !! end
2618
2619 !! test
2620 Image caption containing another image
2621 !! input
2622 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
2623 !! result
2624 <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>
2625
2626 !! end
2627
2628 !! test
2629 Image caption containing a newline
2630 !! input
2631 [[Image:Foobar.jpg|This
2632 *is some text]]
2633 !! result
2634 <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>
2635 </p>
2636 !!end
2637
2638
2639 !! test
2640 Bug 3090: External links other than http: in image captions
2641 !! input
2642 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
2643 !! result
2644 <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>
2645
2646 !! end
2647
2648
2649 ###
2650 ### Subpages
2651 ###
2652 !! article
2653 Subpage test/subpage
2654 !! text
2655 foo
2656 !! endarticle
2657
2658 !! test
2659 Subpage link
2660 !! options
2661 subpage title=[[Subpage test]]
2662 !! input
2663 [[/subpage]]
2664 !! result
2665 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
2666 </p>
2667 !! end
2668
2669 !! test
2670 Subpage noslash link
2671 !! options
2672 subpage title=[[Subpage test]]
2673 !!input
2674 [[/subpage/]]
2675 !! result
2676 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
2677 </p>
2678 !! end
2679
2680 !! test
2681 Disabled subpages
2682 !! input
2683 [[/subpage]]
2684 !! result
2685 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
2686 </p>
2687 !! end
2688
2689 !! test
2690 BUG 561: {{/Subpage}}
2691 !! options
2692 subpage title=[[Page]]
2693 !! input
2694 {{/Subpage}}
2695 !! result
2696 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
2697 </p>
2698 !! end
2699
2700 ###
2701 ### Categories
2702 ###
2703 !! article
2704 Category:MediaWiki User's Guide
2705 !! text
2706 blah
2707 !! endarticle
2708
2709 !! test
2710 Link to category
2711 !! input
2712 [[:Category:MediaWiki User's Guide]]
2713 !! result
2714 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
2715 </p>
2716 !! end
2717
2718 !! test
2719 Simple category
2720 !! options
2721 cat
2722 !! input
2723 [[Category:MediaWiki User's Guide]]
2724 !! result
2725 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
2726 !! end
2727
2728 ###
2729 ### Inter-language links
2730 ###
2731 !! test
2732 Inter-language links
2733 !! options
2734 ill
2735 !! input
2736 [[es:Alimento]]
2737 [[fr:Nourriture]]
2738 [[zh:&#39135;&#21697;]]
2739 !! result
2740 es:Alimento fr:Nourriture zh:食品
2741 !! end
2742
2743 ###
2744 ### Sections
2745 ###
2746 !! test
2747 Basic section headings
2748 !! options
2749 title=[[Parser test script]]
2750 !! input
2751 == Headline 1 ==
2752 Some text
2753
2754 ==Headline 2==
2755 More
2756 ===Smaller headline===
2757 Blah blah
2758 !! result
2759 <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>
2760 <p>Some text
2761 </p>
2762 <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>
2763 <p>More
2764 </p>
2765 <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>
2766 <p>Blah blah
2767 </p>
2768 !! end
2769
2770 !! test
2771 Section headings with TOC
2772 !! options
2773 title=[[Parser test script]]
2774 !! input
2775 == Headline 1 ==
2776 === Subheadline 1 ===
2777 ===== Skipping a level =====
2778 ====== Skipping a level ======
2779
2780 == Headline 2 ==
2781 Some text
2782 ===Another headline===
2783 !! result
2784 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
2785 <ul>
2786 <li class='toclevel-1'><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
2787 <ul>
2788 <li class='toclevel-2'><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
2789 <ul>
2790 <li class='toclevel-3'><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
2791 <ul>
2792 <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>
2793 </ul>
2794 </li>
2795 </ul>
2796 </li>
2797 </ul>
2798 </li>
2799 <li class='toclevel-1'><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
2800 <ul>
2801 <li class='toclevel-2'><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
2802 </ul>
2803 </li>
2804 </ul>
2805 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
2806 <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>
2807 <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>
2808 <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>
2809 <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>
2810 <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>
2811 <p>Some text
2812 </p>
2813 <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>
2814
2815 !! end
2816
2817 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
2818 !! test
2819 Handling of sections up to level 6 and beyond
2820 !! input
2821 = Level 1 Heading=
2822 == Level 2 Heading==
2823 === Level 3 Heading===
2824 ==== Level 4 Heading====
2825 ===== Level 5 Heading=====
2826 ====== Level 6 Heading======
2827 ======= Level 7 Heading=======
2828 ======== Level 8 Heading========
2829 ========= Level 9 Heading=========
2830 ========== Level 10 Heading==========
2831 !! result
2832 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
2833 <ul>
2834 <li class='toclevel-1'><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
2835 <ul>
2836 <li class='toclevel-2'><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
2837 <ul>
2838 <li class='toclevel-3'><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
2839 <ul>
2840 <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>
2841 <ul>
2842 <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>
2843 <ul>
2844 <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>
2845 <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>
2846 <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>
2847 <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>
2848 <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>
2849 </ul>
2850 </li>
2851 </ul>
2852 </li>
2853 </ul>
2854 </li>
2855 </ul>
2856 </li>
2857 </ul>
2858 </li>
2859 </ul>
2860 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
2861 <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>
2862 <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>
2863 <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>
2864 <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>
2865 <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>
2866 <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>
2867 <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>
2868 <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>
2869 <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>
2870 <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>
2871
2872 !! end
2873
2874 !! test
2875 Resolving duplicate section names
2876 !! options
2877 title=[[Parser test script]]
2878 !! input
2879 == Foo bar ==
2880 == Foo bar ==
2881 !! result
2882 <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>
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: Foo bar">edit</a>]</div><a name="Foo_bar_2"></a><h2> Foo bar </h2>
2884
2885 !! end
2886
2887 !! article
2888 Template:sections
2889 !! text
2890 ===Section 1===
2891 ==Section 2==
2892 !! endarticle
2893
2894 !! test
2895 Template with sections, __NOTOC__
2896 !! options
2897 title=[[Parser test script]]
2898 !! input
2899 __NOTOC__
2900 ==Section 0==
2901 {{sections}}
2902 ==Section 4==
2903 !! result
2904 <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>
2905 <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>
2906 <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>
2907 <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>
2908
2909 !! end
2910
2911 !! test
2912 __NOEDITSECTION__ keyword
2913 !! input
2914 __NOEDITSECTION__
2915 ==Section 1==
2916 ==Section 2==
2917 !! result
2918 <a name="Section_1"></a><h2>Section 1</h2>
2919 <a name="Section_2"></a><h2>Section 2</h2>
2920
2921 !! end
2922
2923 !! test
2924 Link inside a section heading
2925 !! options
2926 title=[[Parser test script]]
2927 !! input
2928 ==Section with a [[Main Page|link]] in it==
2929 !! result
2930 <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>
2931
2932 !! end
2933
2934
2935 !! test
2936 BUG 1219 URL next to image (good)
2937 !! input
2938 http://example.com [[Image:foobar.jpg]]
2939 !! result
2940 <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>
2941 </p>
2942 !!end
2943
2944 !! test
2945 BUG 1219 URL next to image (broken)
2946 !! input
2947 http://example.com[[Image:foobar.jpg]]
2948 !! result
2949 <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>
2950 </p>
2951 !!end
2952
2953 !! test
2954 Bug 1186 news: in the middle of text
2955 !! input
2956 http://en.wikinews.org/wiki/Wikinews:Workplace
2957 !! result
2958 <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>
2959 </p>
2960 !!end
2961
2962
2963 !! test
2964 Namespaced link must have a title
2965 !! input
2966 [[Project:]]
2967 !! result
2968 <p>[[Project:]]
2969 </p>
2970 !!end
2971
2972 !! test
2973 Namespaced link must have a title (bad fragment version)
2974 !! input
2975 [[Project:#fragment]]
2976 !! result
2977 <p>[[Project:#fragment]]
2978 </p>
2979 !!end
2980
2981
2982 !! test
2983 div with no attributes
2984 !! input
2985 <div>HTML rocks</div>
2986 !! result
2987 <div>HTML rocks</div>
2988
2989 !! end
2990
2991 !! test
2992 div with double-quoted attribute
2993 !! input
2994 <div id="rock">HTML rocks</div>
2995 !! result
2996 <div id="rock">HTML rocks</div>
2997
2998 !! end
2999
3000 !! test
3001 div with single-quoted attribute
3002 !! input
3003 <div id='rock'>HTML rocks</div>
3004 !! result
3005 <div id="rock">HTML rocks</div>
3006
3007 !! end
3008
3009 !! test
3010 div with unquoted attribute
3011 !! input
3012 <div id=rock>HTML rocks</div>
3013 !! result
3014 <div id="rock">HTML rocks</div>
3015
3016 !! end
3017
3018 !! test
3019 div with illegal double attributes
3020 !! input
3021 <div align="center" align="right">HTML rocks</div>
3022 !! result
3023 <div align="right">HTML rocks</div>
3024
3025 !!end
3026
3027 !! test
3028 HTML multiple attributes correction
3029 !! input
3030 <p class="error" class="awesome">Awesome!</p>
3031 !! result
3032 <p class="awesome">Awesome!</p>
3033
3034 !!end
3035
3036 !! test
3037 Table multiple attributes correction
3038 !! input
3039 {|
3040 !+ class="error" class="awesome"| status
3041 |}
3042 !! result
3043 <table>
3044 <tr>
3045 <th class="awesome"> status
3046 </th></tr></table>
3047
3048 !!end
3049
3050 !! test
3051 DIV IN UPPERCASE
3052 !! input
3053 <DIV ALIGN="center">HTML ROCKS</DIV>
3054 !! result
3055 <div align="center">HTML ROCKS</div>
3056
3057 !!end
3058
3059
3060 !! test
3061 text with amp in the middle of nowhere
3062 !! input
3063 Remember AT&T?
3064 !!result
3065 <p>Remember AT&amp;T?
3066 </p>
3067 !! end
3068
3069 !! test
3070 text with character entity: eacute
3071 !! input
3072 I always thought &eacute; was a cute letter.
3073 !! result
3074 <p>I always thought &eacute; was a cute letter.
3075 </p>
3076 !! end
3077
3078 !! test
3079 text with undefined character entity: xacute
3080 !! input
3081 I always thought &xacute; was a cute letter.
3082 !! result
3083 <p>I always thought &amp;xacute; was a cute letter.
3084 </p>
3085 !! end
3086
3087
3088 ###
3089 ### Media links
3090 ###
3091
3092 !! test
3093 Media link
3094 !! input
3095 [[Media:Foobar.jpg]]
3096 !! result
3097 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Media:Foobar.jpg</a>
3098 </p>
3099 !! end
3100
3101 !! test
3102 Media link with text
3103 !! input
3104 [[Media:Foobar.jpg|A neat file to look at]]
3105 !! result
3106 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">A neat file to look at</a>
3107 </p>
3108 !! end
3109
3110 # FIXME: this is still bad HTML tag nesting
3111 !! test
3112 Media link with nasty text
3113 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3114 !! input
3115 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3116 !! result
3117 <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>
3118
3119 !! end
3120
3121 !! test
3122 Media link to nonexistent file (bug 1702)
3123 !! input
3124 [[Media:No such.jpg]]
3125 !! result
3126 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class='new' title="No such.jpg">Media:No such.jpg</a>
3127 </p>
3128 !! end
3129
3130 !! test
3131 Image link to nonexistent file (bug 1850 - good)
3132 !! input
3133 [[Image:No such.jpg]]
3134 !! result
3135 <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>
3136 </p>
3137 !! end
3138
3139 !! test
3140 :Image link to nonexistent file (bug 1850 - bad)
3141 !! input
3142 [[:Image:No such.jpg]]
3143 !! result
3144 <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>
3145 </p>
3146 !! end
3147
3148
3149
3150 !! test
3151 Character reference normalization in link text (bug 1938)
3152 !! input
3153 [[Main Page|this&that]]
3154 !! result
3155 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3156 </p>
3157 !!end
3158
3159 !! test
3160 Empty attribute crash test (bug 2067)
3161 !! input
3162 <font color="">foo</font>
3163 !! result
3164 <p><font color="">foo</font>
3165 </p>
3166 !! end
3167
3168 !! test
3169 Empty attribute crash test single-quotes (bug 2067)
3170 !! input
3171 <font color=''>foo</font>
3172 !! result
3173 <p><font color="">foo</font>
3174 </p>
3175 !! end
3176
3177 !! test
3178 Attribute test: equals, then nothing
3179 !! input
3180 <font color=>foo</font>
3181 !! result
3182 <p><font>foo</font>
3183 </p>
3184 !! end
3185
3186 !! test
3187 Attribute test: unquoted value
3188 !! input
3189 <font color=x>foo</font>
3190 !! result
3191 <p><font color="x">foo</font>
3192 </p>
3193 !! end
3194
3195 !! test
3196 Attribute test: unquoted but illegal value (hash)
3197 !! input
3198 <font color=#x>foo</font>
3199 !! result
3200 <p><font color="#x">foo</font>
3201 </p>
3202 !! end
3203
3204 !! test
3205 Attribute test: no value
3206 !! input
3207 <font color>foo</font>
3208 !! result
3209 <p><font color="color">foo</font>
3210 </p>
3211 !! end
3212
3213 !! test
3214 Bug 2095: link with three closing brackets
3215 !! input
3216 [[Main Page]]]
3217 !! result
3218 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3219 </p>
3220 !! end
3221
3222 !! test
3223 Bug 2095: link with pipe and three closing brackets
3224 !! input
3225 [[Main Page|link]]]
3226 !! result
3227 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3228 </p>
3229 !! end
3230
3231 !! test
3232 Bug 2095: link with pipe and three closing brackets, version 2
3233 !! input
3234 [[Main Page|[http://example.com/]]]
3235 !! result
3236 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3237 </p>
3238 !! end
3239
3240
3241 ###
3242 ### Safety
3243 ###
3244
3245 !! article
3246 Template:Dangerous attribute
3247 !! text
3248 " onmouseover="alert(document.cookie)
3249 !! endarticle
3250
3251 !! article
3252 Template:Dangerous style attribute
3253 !! text
3254 border-size: expression(alert(document.cookie))
3255 !! endarticle
3256
3257 !! article
3258 Template:Div style
3259 !! text
3260 <div style="float: right; {{{1}}}">Magic div</div>
3261 !! endarticle
3262
3263 !! test
3264 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3265 !! input
3266 <div title="{{test}}"></div>
3267 !! result
3268 <div title="This is a test template"></div>
3269
3270 !! end
3271
3272 !! test
3273 Bug 2304: HTML attribute safety (dangerous template; 2309)
3274 !! input
3275 <div title="{{dangerous attribute}}"></div>
3276 !! result
3277 <div title=""></div>
3278
3279 !! end
3280
3281 !! test
3282 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3283 !! input
3284 <div style="{{dangerous style attribute}}"></div>
3285 !! result
3286 <div></div>
3287
3288 !! end
3289
3290 !! test
3291 Bug 2304: HTML attribute safety (safe parameter; 2309)
3292 !! input
3293 {{div style|width: 200px}}
3294 !! result
3295 <div style="float: right; width: 200px">Magic div</div>
3296
3297 !! end
3298
3299 !! test
3300 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3301 !! input
3302 {{div style|width: expression(alert(document.cookie))}}
3303 !! result
3304 <div>Magic div</div>
3305
3306 !! end
3307
3308 !! test
3309 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3310 !! input
3311 {{div style|"><script>alert(document.cookie)</script>}}
3312 !! result
3313 <div>Magic div</div>
3314
3315 !! end
3316
3317 !! test
3318 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3319 !! input
3320 {{div style|" ><script>alert(document.cookie)</script>}}
3321 !! result
3322 <div style="float: right; ">Magic div</div>
3323
3324 !! end
3325
3326 !! test
3327 Bug 2304: HTML attribute safety (link)
3328 !! input
3329 <div title="[[Main Page]]"></div>
3330 !! result
3331 <div title="&#91;&#91;Main Page]]"></div>
3332
3333 !! end
3334
3335 !! test
3336 Bug 2304: HTML attribute safety (italics)
3337 !! input
3338 <div title="''foobar''"></div>
3339 !! result
3340 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3341
3342 !! end
3343
3344 !! test
3345 Bug 2304: HTML attribute safety (bold)
3346 !! input
3347 <div title="'''foobar'''"></div>
3348 !! result
3349 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3350
3351 !! end
3352
3353
3354 !! test
3355 Bug 2304: HTML attribute safety (ISBN)
3356 !! input
3357 <div title="ISBN 1234567890"></div>
3358 !! result
3359 <div title="&#73;SBN 1234567890"></div>
3360
3361 !! end
3362
3363 !! test
3364 Bug 2304: HTML attribute safety (RFC)
3365 !! input
3366 <div title="RFC 1234"></div>
3367 !! result
3368 <div title="&#82;FC 1234"></div>
3369
3370 !! end
3371
3372 !! test
3373 Bug 2304: HTML attribute safety (PMID)
3374 !! input
3375 <div title="PMID 1234567890"></div>
3376 !! result
3377 <div title="&#80;MID 1234567890"></div>
3378
3379 !! end
3380
3381 !! test
3382 Bug 2304: HTML attribute safety (web link)
3383 !! input
3384 <div title="http://example.com/"></div>
3385 !! result
3386 <div title="http&#58;//example.com/"></div>
3387
3388 !! end
3389
3390 !! test
3391 Bug 2304: HTML attribute safety (named web link)
3392 !! input
3393 <div title="[http://example.com/ link]"></div>
3394 !! result
3395 <div title="&#91;http&#58;//example.com/ link]"></div>
3396
3397 !! end
3398
3399 !! test
3400 Bug 3244: HTML attribute safety (extension; safe)
3401 !! input
3402 <div style="<nowiki>background:blue</nowiki>"></div>
3403 !! result
3404 <div style="background:blue"></div>
3405
3406 !! end
3407
3408 !! test
3409 Bug 3244: HTML attribute safety (extension; unsafe)
3410 !! input
3411 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3412 !! result
3413 <div></div>
3414
3415 !! end
3416
3417 !! test
3418 Math section safety when disabled
3419 !! input
3420 <math><script>alert(document.cookies);</script></math>
3421 !! result
3422 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3423 </p>
3424 !! end
3425
3426 # More MSIE fun discovered by Tom Gilder
3427
3428 !! test
3429 MSIE CSS safety test: spurious slash
3430 !! input
3431 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3432 !! result
3433 <div>evil</div>
3434
3435 !! end
3436
3437 !! test
3438 MSIE CSS safety test: hex code
3439 !! input
3440 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3441 !! result
3442 <div>evil</div>
3443
3444 !! end
3445
3446 !! test
3447 MSIE CSS safety test: comment in url
3448 !! input
3449 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3450 !! result
3451 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3452
3453 !! end
3454
3455 !! test
3456 MSIE CSS safety test: comment in expression
3457 !! input
3458 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3459 !! result
3460 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3461
3462 !! end
3463
3464
3465 !! test
3466 Table attribute legitimate extension
3467 !! input
3468 {|
3469 !+ style="<nowiki>color:blue</nowiki>"| status
3470 |}
3471 !! result
3472 <table>
3473 <tr>
3474 <th style="color:blue"> status
3475 </th></tr></table>
3476
3477 !!end
3478
3479 !! test
3480 Table attribute safety
3481 !! input
3482 {|
3483 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3484 |}
3485 !! result
3486 <table>
3487 <tr>
3488 <th> status
3489 </th></tr></table>
3490
3491 !! end
3492
3493 ###
3494 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3495 ###
3496 !! test
3497 Parser hook: empty input
3498 !! input
3499 <tag></tag>
3500 !! result
3501 <pre>
3502 string(0) ""
3503 array(0) {
3504 }
3505 </pre>
3506
3507 !! end
3508
3509 !! test
3510 Parser hook: empty input using terminated empty elements
3511 !! input
3512 <tag/>
3513 !! result
3514 <pre>
3515 NULL
3516 array(0) {
3517 }
3518 </pre>
3519
3520 !! end
3521
3522 !! test
3523 Parser hook: empty input using terminated empty elements (space before)
3524 !! input
3525 <tag />
3526 !! result
3527 <pre>
3528 NULL
3529 array(0) {
3530 }
3531 </pre>
3532
3533 !! end
3534
3535 !! test
3536 Parser hook: basic input
3537 !! input
3538 <tag>input</tag>
3539 !! result
3540 <pre>
3541 string(5) "input"
3542 array(0) {
3543 }
3544 </pre>
3545
3546 !! end
3547
3548
3549 !! test
3550 Parser hook: case insensetive
3551 !! input
3552 <TAG>input</TAG>
3553 !! result
3554 <pre>
3555 string(5) "input"
3556 array(0) {
3557 }
3558 </pre>
3559
3560 !! end
3561
3562
3563 !! test
3564 Parser hook: case insensetive, redux
3565 !! input
3566 <TaG>input</TAg>
3567 !! result
3568 <pre>
3569 string(5) "input"
3570 array(0) {
3571 }
3572 </pre>
3573
3574 !! end
3575
3576 !! test
3577 Parser hook: nested tags
3578 !! options
3579 noxml
3580 !! input
3581 <tag><tag></tag></tag>
3582 !! result
3583 <pre>
3584 string(5) "<tag>"
3585 array(0) {
3586 }
3587 </pre>&lt;/tag&gt;
3588
3589 !! end
3590
3591 !! test
3592 Parser hook: basic arguments
3593 !! input
3594 <tag width=200 height = "100" depth = '50' square></tag>
3595 !! result
3596 <pre>
3597 string(0) ""
3598 array(4) {
3599 ["width"]=>
3600 string(3) "200"
3601 ["height"]=>
3602 string(3) "100"
3603 ["depth"]=>
3604 string(2) "50"
3605 ["square"]=>
3606 string(6) "square"
3607 }
3608 </pre>
3609
3610 !! end
3611
3612 !! test
3613 Parser hook: argument containing a forward slash (bug 5344)
3614 !! input
3615 <tag filename='/tmp/bla'></tag>
3616 !! result
3617 <pre>
3618 string(0) ""
3619 array(1) {
3620 ["filename"]=>
3621 string(8) "/tmp/bla"
3622 }
3623 </pre>
3624
3625 !! end
3626
3627 !! test
3628 Parser hook: empty input using terminated empty elements (bug 2374)
3629 !! input
3630 <tag foo=bar/>text
3631 !! result
3632 <pre>
3633 NULL
3634 array(1) {
3635 ["foo"]=>
3636 string(3) "bar"
3637 }
3638 </pre>text
3639
3640 !! end
3641
3642 # </tag> should be output literally since there is no matching tag that begins it
3643 !! test
3644 Parser hook: basic arguments using terminated empty elements (bug 2374)
3645 !! input
3646 <tag width=200 height = "100" depth = '50' square/>
3647 other stuff
3648 </tag>
3649 !! result
3650 <pre>
3651 NULL
3652 array(4) {
3653 ["width"]=>
3654 string(3) "200"
3655 ["height"]=>
3656 string(3) "100"
3657 ["depth"]=>
3658 string(2) "50"
3659 ["square"]=>
3660 string(6) "square"
3661 }
3662 </pre>
3663 <p>other stuff
3664 &lt;/tag&gt;
3665 </p>
3666 !! end
3667
3668 ###
3669 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
3670 ###
3671
3672 !! test
3673 Parser hook: static parser hook not inside a comment
3674 !! input
3675 <statictag>hello, world</statictag>
3676 <statictag action=flush/>
3677 !! result
3678 <p>hello, world
3679 </p>
3680 !! end
3681
3682
3683 !! test
3684 Parser hook: static parser hook inside a comment
3685 !! input
3686 <!-- <statictag>hello, world</statictag> -->
3687 <statictag action=flush/>
3688 !! result
3689 <p><br />
3690 </p>
3691 !! end
3692
3693 # Nested template calls; this case was broken by Parser.php rev 1.506,
3694 # since reverted.
3695
3696 !! article
3697 Template:One-parameter
3698 !! text
3699 (My parameter is: {{{1}}})
3700 !! endarticle
3701
3702 !! article
3703 Template:Map-one-parameter
3704 !! text
3705 {{{{{1}}}|{{{2}}}}}
3706 !! endarticle
3707
3708 !! test
3709 Nested template calls
3710 !! input
3711 {{Map-one-parameter|One-parameter|param}}
3712 !! result
3713 <p>(My parameter is: param)
3714 </p>
3715 !! end
3716
3717
3718 ###
3719 ### Sanitizer
3720 ###
3721 !! test
3722 Sanitizer: Closing of open tags
3723 !! input
3724 <s></s><table></table>
3725 !! result
3726 <s></s><table></table>
3727
3728 !! end
3729
3730 !! test
3731 Sanitizer: Closing of open but not closed tags
3732 !! input
3733 <s>foo
3734 !! result
3735 <p><s>foo</s>
3736 </p>
3737 !! end
3738
3739 !! test
3740 Sanitizer: Closing of closed but not open tags
3741 !! input
3742 </s>
3743 !! result
3744 <p>&lt;/s&gt;
3745 </p>
3746 !! end
3747
3748 !! test
3749 Sanitizer: Closing of closed but not open table tags
3750 !! input
3751 Table not started</td></tr></table>
3752 !! result
3753 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
3754 </p>
3755 !! end
3756
3757 !! test
3758 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
3759 !! input
3760 <span id="æ: v">byte</span>[[#æ: v|backlink]]
3761 !! result
3762 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
3763 </p>
3764 !! end
3765
3766 !! test
3767 Sanitizer: Validating the contents of the id attribute (bug 4515)
3768 !! options
3769 disabled
3770 !! input
3771 <br id=9 />
3772 !! result
3773 Something, but defenetly not <br id="9" />...
3774 !! end
3775
3776 !! test
3777 Language converter: output gets cut off unexpectedly (bug 5757)
3778 !! options
3779 language=zh
3780 !! input
3781 this bit is safe: }-
3782
3783 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
3784
3785 then we get cut off here: }-
3786
3787 all additional text is vanished
3788 !! result
3789 <p>this bit is safe: }-
3790 </p><p>but if we add a conversion instance: xxx
3791 </p><p>then we get cut off here: }-
3792 </p><p>all additional text is vanished
3793 </p>
3794 !! end
3795
3796 !! test
3797 Self closed html pairs (bug 5487)
3798 !! options
3799 !! input
3800 <center><font id="bug" />Centered text</center>
3801 <div><font id="bug2" />In div text</div>
3802 !! result
3803 <div class="center">&lt;font id="bug" /&gt;Centered text</div>
3804 <div>&lt;font id="bug2" /&gt;In div text</div>
3805
3806 !! end
3807
3808 #
3809 #
3810 #
3811
3812 !! test
3813 HTML bullet list, closed tags (bug 5497)
3814 !! input
3815 <ul>
3816 <li>One</li>
3817 <li>Two</li>
3818 </ul>
3819 !! result
3820 <ul>
3821 <li>One</li>
3822 <li>Two</li>
3823 </ul>
3824
3825 !! end
3826
3827 !! test
3828 HTML bullet list, unclosed tags (bug 5497)
3829 !! input
3830 <ul>
3831 <li>One
3832 <li>Two
3833 </ul>
3834 !! result
3835 <ul>
3836 <li>One
3837 </li><li>Two
3838 </li></ul>
3839
3840 !! end
3841
3842 !! test
3843 HTML ordered list, closed tags (bug 5497)
3844 !! input
3845 <ol>
3846 <li>One</li>
3847 <li>Two</li>
3848 </ol>
3849 !! result
3850 <ol>
3851 <li>One</li>
3852 <li>Two</li>
3853 </ol>
3854
3855 !! end
3856
3857 !! test
3858 HTML ordered list, unclosed tags (bug 5497)
3859 !! input
3860 <ol>
3861 <li>One
3862 <li>Two
3863 </ol>
3864 !! result
3865 <ol>
3866 <li>One
3867 </li><li>Two
3868 </li></ol>
3869
3870 !! end
3871
3872 !! test
3873 HTML nested bullet list, closed tags (bug 5497)
3874 !! input
3875 <ul>
3876 <li>One</li>
3877 <li>Two:
3878 <ul>
3879 <li>Sub-one</li>
3880 <li>Sub-two</li>
3881 </ul>
3882 </li>
3883 </ul>
3884 !! result
3885 <ul>
3886 <li>One</li>
3887 <li>Two:
3888 <ul>
3889 <li>Sub-one</li>
3890 <li>Sub-two</li>
3891 </ul>
3892 </li>
3893 </ul>
3894
3895 !! end
3896
3897 !! test
3898 HTML nested bullet list, open tags (bug 5497)
3899 !! input
3900 <ul>
3901 <li>One
3902 <li>Two:
3903 <ul>
3904 <li>Sub-one
3905 <li>Sub-two
3906 </ul>
3907 </li>
3908 </ul>
3909 !! result
3910 <ul>
3911 <li>One
3912 </li><li>Two:
3913 <ul>
3914 <li>Sub-one
3915 </li><li>Sub-two
3916 </li></ul>
3917 </li></ul>
3918
3919 !! end
3920
3921 !! test
3922 HTML nested ordered list, closed tags (bug 5497)
3923 !! input
3924 <ol>
3925 <li>One</li>
3926 <li>Two:
3927 <ol>
3928 <li>Sub-one</li>
3929 <li>Sub-two</li>
3930 </ol>
3931 </li>
3932 </ol>
3933 !! result
3934 <ol>
3935 <li>One</li>
3936 <li>Two:
3937 <ol>
3938 <li>Sub-one</li>
3939 <li>Sub-two</li>
3940 </ol>
3941 </li>
3942 </ol>
3943
3944 !! end
3945
3946 !! test
3947 HTML nested ordered list, open tags (bug 5497)
3948 !! input
3949 <ol>
3950 <li>One
3951 <li>Two:
3952 <ol>
3953 <li>Sub-one
3954 <li>Sub-two
3955 </ol>
3956 </li>
3957 </ol>
3958 !! result
3959 <ol>
3960 <li>One
3961 </li><li>Two:
3962 <ol>
3963 <li>Sub-one
3964 </li><li>Sub-two
3965 </li></ol>
3966 </li></ol>
3967
3968 !! end
3969
3970 !!test
3971 bug 5918: autonumbering
3972 !! input
3973 [http://first/] [http://second] [ftp://ftp]
3974
3975 ftp://inlineftp
3976
3977 [mailto:enclosed@mail.tld With target]
3978
3979 [mailto:enclosed@mail.tld]
3980
3981 mailto:inline@mail.tld
3982 !! result
3983 <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>
3984 </p><p><a href="ftp://inlineftp" class='external free' title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
3985 </p><p><a href="mailto:enclosed@mail.tld" class='external text' title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
3986 </p><p><a href="mailto:enclosed@mail.tld" class='external autonumber' title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
3987 </p><p><a href="mailto:inline@mail.tld" class='external free' title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
3988 </p>
3989 !! end
3990
3991
3992 #
3993 # Security and HTML correctness
3994 # From Nick Jenkins' fuzz testing
3995 #
3996
3997 !! test
3998 Fuzz testing: Parser13
3999 !! input
4000 {|
4001 | http://a|
4002 !! result
4003 <table>
4004 <tr>
4005 <td>
4006 </td>
4007 </tr>
4008 </table>
4009
4010 !! end
4011
4012 !! test
4013 Fuzz testing: Parser14
4014 !! input
4015 == onmouseover= ==
4016 http://__TOC__
4017 !! result
4018 <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>
4019 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4020 <ul>
4021 <li class='toclevel-1'><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4022 </ul>
4023 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4024
4025 !! end
4026
4027 !! test
4028 Fuzz testing: Parser14-table
4029 !! input
4030 ==a==
4031 {| STYLE=__TOC__
4032 !! result
4033 <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>
4034 <table style="&#95;_TOC&#95;_">
4035 <tr><td></td></tr>
4036 </table>
4037
4038 !! end
4039
4040 # Known to produce bogus xml (extra </td>)
4041 !! test
4042 Fuzz testing: Parser16
4043 !! options
4044 noxml
4045 !! input
4046 {|
4047 !https://||||||
4048 !! result
4049 <table>
4050 <tr>
4051 <th>https://</th><th></th><th></th><th>
4052 </td>
4053 </tr>
4054 </table>
4055
4056 !! end
4057
4058 !! test
4059 Fuzz testing: Parser21
4060 !! input
4061 {|
4062 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4063 |
4064 !! result
4065 <table>
4066 <tr>
4067 <th> <a href="irc://{{ftp://a" class='external free' title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4068 </th><td>
4069 </td>
4070 </tr>
4071 </table>
4072
4073 !! end
4074
4075 !! test
4076 Fuzz testing: Parser22
4077 !! input
4078 http://===r:::https://b
4079
4080 {|
4081 !!result
4082 <p><a href="http://===r:::https://b" class='external free' title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4083 </p>
4084 <table>
4085 <tr><td></td></tr>
4086 </table>
4087
4088 !! end
4089
4090 # Known to produce bad XML for now
4091 !! test
4092 Fuzz testing: Parser24
4093 !! options
4094 noxml
4095 !! input
4096 {|
4097 {{{|
4098 <u CLASS=
4099 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4100 <br style="onmouseover='alert(document.cookie);' " />
4101
4102 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4103 |
4104 !! result
4105 <table>
4106
4107 <u class="&#124;">} &gt;
4108 <br style="onmouseover='alert(document.cookie);' " />
4109
4110 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4111 <tr>
4112 <td></u>
4113 </td>
4114 </tr>
4115 </table>
4116
4117 !! end
4118
4119 # Known to produce bad XML for now
4120 !!test
4121 Fuzz testing: Parser25 (bug 6055)
4122 !! options
4123 noxml
4124 !! input
4125 {{{
4126 |
4127 <LI CLASS=||
4128 >
4129 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4130 !! result
4131 <li class="&#124;&#124;">
4132 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4133
4134 !! end
4135
4136 !!test
4137 Fuzz testing: URL adjacent extension (with space, clean)
4138 !! options
4139 !! input
4140 http://example.com <nowiki>junk</nowiki>
4141 !! result
4142 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> junk
4143 </p>
4144 !!end
4145
4146 !!test
4147 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4148 !! options
4149 !! input
4150 http://example.com<nowiki>junk</nowiki>
4151 !! result
4152 <p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>junk
4153 </p>
4154 !!end
4155
4156 !!test
4157 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4158 !! options
4159 !! input
4160 http://example.com<pre>junk</pre>
4161 !! result
4162 <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4163
4164 !!end
4165
4166 #
4167 #
4168 #
4169
4170 TODO:
4171 more images
4172 more tables
4173 math
4174 character entities
4175 and much more