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