(bug 7139) Increasing the visual width of the edit summary field on larger screen...
[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 ###
162 ### Comments
163 ###
164 !! test
165 Comment test 1
166 !! input
167 <!-- comment 1 --> asdf
168 <!-- comment 2 -->
169 !! result
170 <pre>asdf
171 </pre>
172
173 !! end
174
175 !! test
176 Comment test 2
177 !! input
178 asdf
179 <!-- comment 1 -->
180 jkl
181 !! result
182 <p>asdf
183 jkl
184 </p>
185 !! end
186
187 !! test
188 Comment test 3
189 !! input
190 asdf
191 <!-- comment 1 -->
192 <!-- comment 2 -->
193 jkl
194 !! result
195 <p>asdf
196 jkl
197 </p>
198 !! end
199
200 !! test
201 Comment test 4
202 !! input
203 asdf<!-- comment 1 -->jkl
204 !! result
205 <p>asdfjkl
206 </p>
207 !! end
208
209 !! test
210 Comment spacing
211 !! input
212 a
213 <!-- foo --> b <!-- bar -->
214 c
215 !! result
216 <p>a
217 </p>
218 <pre> b
219 </pre>
220 <p>c
221 </p>
222 !! end
223
224 !! test
225 Comment whitespace
226 !! input
227 <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
228 !! result
229
230 !! end
231
232 !! test
233 Comment semantics and delimiters
234 !! input
235 <!-- --><!----><!-----><!------>
236 !! result
237
238 !! end
239
240 !! test
241 Comment semantics and delimiters, redux
242 !! input
243 <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
244 -- foo -- funky huh? ... -->
245 !! result
246
247 !! end
248
249 !! test
250 Comment semantics and delimiters: directors cut
251 !! input
252 <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
253 everything starting with < followed by !-- until the first -- and > we see,
254 that wouldn't be valid XML however, since in XML -- has to terminate a comment
255 -->-->
256 !! result
257 <p>-->
258 </p>
259 !! end
260
261 !! test
262 Comment semantics: nesting
263 !! input
264 <!--<!-- no, we're not going to do anything fancy here -->-->
265 !! result
266 <p>-->
267 </p>
268 !! end
269
270 !! test
271 Comment semantics: unclosed comment at end
272 !! input
273 <!--This comment will run out to the end of the document
274 !! result
275
276 !! end
277
278
279 ###
280 ### Preformatted text
281 ###
282 !! test
283 Preformatted text
284 !! input
285 This is some
286 Preformatted text
287 With ''italic''
288 And '''bold'''
289 And a [[Main Page|link]]
290 !! result
291 <pre>This is some
292 Preformatted text
293 With <i>italic</i>
294 And <b>bold</b>
295 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
296 </pre>
297 !! end
298
299 !! test
300 <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
301 !! input
302 <pre><nowiki>
303 <b>
304 <cite>
305 <em>
306 </nowiki></pre>
307 !! result
308 <pre>
309 &lt;b&gt;
310 &lt;cite&gt;
311 &lt;em&gt;
312 </pre>
313
314 !! end
315
316 !! test
317 Regression with preformatted in <center>
318 !! input
319 <center>
320 Blah
321 </center>
322 !! result
323 <center>
324 <pre>Blah
325 </pre>
326 </center>
327
328 !! end
329
330 !! test
331 <pre> with attributes (bug 3202)
332 !! input
333 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
334 !! result
335 <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
336
337 !! end
338
339 !! test
340 <pre> with width attribute (bug 3202)
341 !! input
342 <pre width="8">Narrow screen goodies</pre>
343 !! result
344 <pre width="8">Narrow screen goodies</pre>
345
346 !! end
347
348 !! test
349 <pre> with forbidden attribute (bug 3202)
350 !! input
351 <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
352 !! result
353 <pre width="8">Narrow screen goodies</pre>
354
355 !! end
356
357 !! test
358 <pre> with forbidden attribute values (bug 3202)
359 !! input
360 <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
361 !! result
362 <pre width="8">Narrow screen goodies</pre>
363
364 !! end
365
366 ###
367 ### Definition lists
368 ###
369 !! test
370 Simple definition
371 !! input
372 ; name : Definition
373 !! result
374 <dl><dt> name&nbsp;</dt><dd> Definition
375 </dd></dl>
376
377 !! end
378
379 !! test
380 Simple definition
381 !! input
382 : Indented text
383 !! result
384 <dl><dd> Indented text
385 </dd></dl>
386
387 !! end
388
389 !! test
390 Definition list with no space
391 !! input
392 ;name:Definition
393 !! result
394 <dl><dt>name</dt><dd>Definition
395 </dd></dl>
396
397 !!end
398
399 !! test
400 Definition list with URL link
401 !! input
402 ; http://example.com/ : definition
403 !! result
404 <dl><dt> <a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
405 </dd></dl>
406
407 !! end
408
409 !! test
410 Definition list with bracketed URL link
411 !! input
412 ;[http://www.example.com/ Example]:Something about it
413 !! result
414 <dl><dt><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">Example</a></dt><dd>Something about it
415 </dd></dl>
416
417 !! end
418
419 !! test
420 Definition list with wikilink containing colon
421 !! input
422 ; [[Help:FAQ]]: The least-read page on Wikipedia
423 !! result
424 <dl><dt> <a href="/index.php?title=Help:FAQ&amp;action=edit" class="new" title="Help:FAQ">Help:FAQ</a></dt><dd> The least-read page on Wikipedia
425 </dd></dl>
426
427 !! end
428
429 # At Brion's and JeLuF's insistence... :)
430 !! test
431 Definition list with wikilink containing colon
432 !! input
433 ; news:alt.wikipedia.rox: This isn't even a real newsgroup!
434 !! result
435 <dl><dt> <a href="news:alt.wikipedia.rox" class="external free" title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a></dt><dd> This isn't even a real newsgroup!
436 </dd></dl>
437
438 !! end
439
440 !! test
441 Malformed definition list with colon
442 !! input
443 ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
444 !! result
445 <dl><dt> <a href="news:alt.wikipedia.rox" class="external free" title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop
446 </dt></dl>
447
448 !! end
449
450 !! test
451 Definition lists: colon in external link text
452 !! input
453 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
454 !! result
455 <dl><dt> <a href="http://www.wikipedia2.org/" class="external text" title="http://www.wikipedia2.org/" rel="nofollow">Wikipedia&nbsp;: The Next Generation</a></dt><dd> OK, I made that up
456 </dd></dl>
457
458 !! end
459
460 !! test
461 Definition lists: colon in HTML attribute
462 !! input
463 ;<b style="display: inline">bold</b>
464 !! result
465 <dl><dt><b style="display: inline">bold</b>
466 </dt></dl>
467
468 !! end
469
470
471 !! test
472 Definition lists: self-closed tag
473 !! input
474 ;one<br/>two : two-line fun
475 !! result
476 <dl><dt>one<br />two&nbsp;</dt><dd> two-line fun
477 </dd></dl>
478
479 !! end
480
481
482 ###
483 ### External links
484 ###
485 !! test
486 External links: non-bracketed
487 !! input
488 Non-bracketed: http://example.com
489 !! result
490 <p>Non-bracketed: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
491 </p>
492 !! end
493
494 !! test
495 External links: numbered
496 !! input
497 Numbered: [http://example.com]
498 Numbered: [http://example.net]
499 Numbered: [http://example.org]
500 !! result
501 <p>Numbered: <a href="http://example.com" class="external autonumber" title="http://example.com" rel="nofollow">[1]</a>
502 Numbered: <a href="http://example.net" class="external autonumber" title="http://example.net" rel="nofollow">[2]</a>
503 Numbered: <a href="http://example.org" class="external autonumber" title="http://example.org" rel="nofollow">[3]</a>
504 </p>
505 !!end
506
507 !! test
508 External links: specified text
509 !! input
510 Specified text: [http://example.com link]
511 !! result
512 <p>Specified text: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow">link</a>
513 </p>
514 !!end
515
516 !! test
517 External links: trail
518 !! input
519 Linktrails should not work for external links: [http://example.com link]s
520 !! result
521 <p>Linktrails should not work for external links: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow">link</a>s
522 </p>
523 !! end
524
525 !! test
526 External links: dollar sign in URL
527 !! input
528 http://example.com/1$2345
529 !! result
530 <p><a href="http://example.com/1$2345" class="external free" title="http://example.com/1$2345" rel="nofollow">http://example.com/1$2345</a>
531 </p>
532 !! end
533
534 !! test
535 External links: dollar sign in URL (named)
536 !! input
537 [http://example.com/1$2345]
538 !! result
539 <p><a href="http://example.com/1$2345" class="external autonumber" title="http://example.com/1$2345" rel="nofollow">[1]</a>
540 </p>
541 !!end
542
543 !! test
544 External links: open square bracket forbidden in URL (bug 4377)
545 !! input
546 http://example.com/1[2345
547 !! result
548 <p><a href="http://example.com/1" class="external free" title="http://example.com/1" rel="nofollow">http://example.com/1</a>[2345
549 </p>
550 !! end
551
552 !! test
553 External links: open square bracket forbidden in URL (named) (bug 4377)
554 !! input
555 [http://example.com/1[2345]
556 !! result
557 <p><a href="http://example.com/1" class="external text" title="http://example.com/1" rel="nofollow">[2345</a>
558 </p>
559 !!end
560
561 !! test
562 External links: nowiki in URL link text (bug 6230)
563 !!input
564 [http://example.com/ <nowiki>''example site''</nowiki>]
565 !! result
566 <p><a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">''example site''</a>
567 </p>
568 !! end
569
570 !! test
571 External links: newline forbidden in text (bug 6230 regression check)
572 !! input
573 [http://example.com/ first
574 second]
575 !! result
576 <p>[<a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a> first
577 second]
578 </p>
579 !!end
580
581 !! test
582 External image
583 !! input
584 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
585 !! result
586 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
587 </p>
588 !! end
589
590 !! test
591 External image from https
592 !! input
593 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
594 !! result
595 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
596 </p>
597 !! end
598
599 !! test
600 Link to non-http image, no img tag
601 !! input
602 Link to non-http image, no img tag: ftp://example.com/test.jpg
603 !! result
604 <p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class="external free" title="ftp://example.com/test.jpg" rel="nofollow">ftp://example.com/test.jpg</a>
605 </p>
606 !! end
607
608 !! test
609 External links: terminating separator
610 !! input
611 Terminating separator: http://example.com/thing,
612 !! result
613 <p>Terminating separator: <a href="http://example.com/thing" class="external free" title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
614 </p>
615 !! end
616
617 !! test
618 External links: intervening separator
619 !! input
620 Intervening separator: http://example.com/1,2,3
621 !! result
622 <p>Intervening separator: <a href="http://example.com/1,2,3" class="external free" title="http://example.com/1,2,3" rel="nofollow">http://example.com/1,2,3</a>
623 </p>
624 !! end
625
626 !! test
627 External links: old bug with URL in query
628 !! input
629 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
630 !! result
631 <p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class="external text" title="http://example.com/thing?url=http://example.com" rel="nofollow">link</a>
632 </p>
633 !! end
634
635 !! test
636 External links: old URL-in-URL bug, mixed protocols
637 !! input
638 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
639 !! result
640 <p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class="external text" title="ftp://example.com?url=http://example.com" rel="nofollow">link</a>
641 </p>
642 !!end
643
644 !! test
645 External links: URL in text
646 !! input
647 URL in text: [http://example.com http://example.com]
648 !! result
649 <p>URL in text: <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>
650 </p>
651 !! end
652
653 !! test
654 External links: Clickable images
655 !! input
656 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
657 !! result
658 <p>ja-style clickable images: <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a>
659 </p>
660 !!end
661
662 !! test
663 External links: raw ampersand
664 !! input
665 Old &amp; use: http://x&y
666 !! result
667 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
668 </p>
669 !! end
670
671 !! test
672 External links: encoded ampersand
673 !! input
674 Old &amp; use: http://x&amp;y
675 !! result
676 <p>Old &amp; use: <a href="http://x&amp;y" class="external free" title="http://x&amp;y" rel="nofollow">http://x&amp;y</a>
677 </p>
678 !! end
679
680 !! test
681 External links: encoded equals (bug 6102)
682 !! input
683 http://example.com/?foo&#61;bar
684 !! result
685 <p><a href="http://example.com/?foo=bar" class="external free" title="http://example.com/?foo=bar" rel="nofollow">http://example.com/?foo=bar</a>
686 </p>
687 !! end
688
689 !! test
690 External links: [raw ampersand]
691 !! input
692 Old &amp; use: [http://x&y]
693 !! result
694 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
695 </p>
696 !! end
697
698 !! test
699 External links: [encoded ampersand]
700 !! input
701 Old &amp; use: [http://x&amp;y]
702 !! result
703 <p>Old &amp; use: <a href="http://x&amp;y" class="external autonumber" title="http://x&amp;y" rel="nofollow">[1]</a>
704 </p>
705 !! end
706
707 !! test
708 External links: [encoded equals] (bug 6102)
709 !! input
710 [http://example.com/?foo&#61;bar]
711 !! result
712 <p><a href="http://example.com/?foo=bar" class="external autonumber" title="http://example.com/?foo=bar" rel="nofollow">[1]</a>
713 </p>
714 !! end
715
716 !! test
717 External links: [IDN ignored character reference in hostname; strip it right off]
718 !! input
719 [http://e&zwnj;xample.com/]
720 !! result
721 <p><a href="http://example.com/" class="external autonumber" title="http://example.com/" rel="nofollow">[1]</a>
722 </p>
723 !! end
724
725 !! test
726 External links: IDN ignored character reference in hostname; strip it right off
727 !! input
728 http://e&zwnj;xample.com/
729 !! result
730 <p><a href="http://example.com/" class="external free" title="http://example.com/" rel="nofollow">http://example.com/</a>
731 </p>
732 !! end
733
734 !! test
735 External links: www.jpeg.org (bug 554)
736 !! input
737 http://www.jpeg.org
738 !!result
739 <p><a href="http://www.jpeg.org" class="external free" title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
740 </p>
741 !! end
742
743 !! test
744 External links: URL within URL (original bug 2)
745 !! input
746 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
747 !! result
748 <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>
749 </p>
750 !! end
751
752 !! test
753 BUG 361: URL inside bracketed URL
754 !! input
755 [http://www.example.com/foo http://www.example.com/bar]
756 !! result
757 <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>
758 </p>
759 !! end
760
761 !! test
762 BUG 361: URL within URL, not bracketed
763 !! input
764 http://www.example.com/foo?=http://www.example.com/bar
765 !! result
766 <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>
767 </p>
768 !! end
769
770 !! test
771 BUG 289: ">"-token in URL-tail
772 !! input
773 http://www.example.com/<hello>
774 !! result
775 <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;
776 </p>
777 !!end
778
779 !! test
780 BUG 289: literal ">"-token in URL-tail
781 !! input
782 http://www.example.com/<b>html</b>
783 !! result
784 <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>
785 </p>
786 !!end
787
788 !! test
789 BUG 289: ">"-token in bracketed URL
790 !! input
791 [http://www.example.com/<hello> stuff]
792 !! result
793 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
794 </p>
795 !!end
796
797 !! test
798 BUG 289: literal ">"-token in bracketed URL
799 !! input
800 [http://www.example.com/<b>html</b> stuff]
801 !! result
802 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
803 </p>
804 !!end
805
806 !! test
807 BUG 289: literal double quote at end of URL
808 !! input
809 http://www.example.com/"hello"
810 !! result
811 <p><a href="http://www.example.com/" class="external free" title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
812 </p>
813 !!end
814
815 !! test
816 BUG 289: literal double quote in bracketed URL
817 !! input
818 [http://www.example.com/"hello" stuff]
819 !! result
820 <p><a href="http://www.example.com/" class="external text" title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
821 </p>
822 !!end
823
824 !! test
825 External links: invalid character
826 Fixme: the missing char seems to have gone missing
827 !! options
828 disabled
829 !! input
830 [http://www.example.com test]
831 !! result
832 <p>[<a href="http://www.example.com" class="external free" title="http://www.example.com" rel="nofollow">http://www.example.com</a> test]
833 </p>
834 !! end
835
836 !! test
837 External links: multiple legal whitespace is fine, Magnus. Don't break it please. (bug 5081)
838 !! input
839 [http://www.example.com test]
840 !! result
841 <p><a href="http://www.example.com" class="external text" title="http://www.example.com" rel="nofollow">test</a>
842 </p>
843 !! end
844
845 !! test
846 External links: wiki links within external link (Bug 3695)
847 !! input
848 [http://example.com [[wikilink]] embedded in ext link]
849 !! result
850 <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>
851 </p>
852 !! end
853
854 !! test
855 BUG 787: Links with one slash after the url protocol are invalid
856 !! input
857 http:/example.com
858
859 [http:/example.com title]
860 !! result
861 <p>http:/example.com
862 </p><p>[http:/example.com title]
863 </p>
864 !! end
865
866 !! test
867 Bug 2702: Mismatched <i>, <b> and <a> tags are invalid
868 !! input
869 ''[http://example.com text'']
870 [http://example.com '''text]'''
871 ''Something [http://example.com in italic'']
872 ''Something [http://example.com mixed''''', even bold]'''
873 '''''Now [http://example.com both''''']
874 !! result
875 <p><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>text</i></a>
876 <a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><b>text</b></a>
877 <i>Something </i><a href="http://example.com" class="external text" title="http://example.com" rel="nofollow"><i>in italic</i></a>
878 <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>
879 <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>
880 </p>
881 !! end
882
883
884 !! test
885 Bug 4781: %26 in URL
886 !! input
887 http://www.example.com/?title=AT%26T
888 !! result
889 <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>
890 </p>
891 !! end
892
893 !! test
894 Bug 4781, 5267: %26 in URL
895 !! input
896 http://www.example.com/?title=100%25_Bran
897 !! result
898 <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>
899 </p>
900 !! end
901
902 !! test
903 Bug 4781, 5267: %28, %29 in URL
904 !! input
905 http://www.example.com/?title=Ben-Hur_%281959_film%29
906 !! result
907 <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>
908 </p>
909 !! end
910
911
912 !! test
913 Bug 4781: %26 in autonumber URL
914 !! input
915 [http://www.example.com/?title=AT%26T]
916 !! result
917 <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>
918 </p>
919 !! end
920
921 !! test
922 Bug 4781, 5267: %26 in autonumber URL
923 !! input
924 [http://www.example.com/?title=100%25_Bran]
925 !! result
926 <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>
927 </p>
928 !! end
929
930 !! test
931 Bug 4781, 5267: %28, %29 in autonumber URL
932 !! input
933 [http://www.example.com/?title=Ben-Hur_%281959_film%29]
934 !! result
935 <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>
936 </p>
937 !! end
938
939
940 !! test
941 Bug 4781: %26 in bracketed URL
942 !! input
943 [http://www.example.com/?title=AT%26T link]
944 !! result
945 <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>
946 </p>
947 !! end
948
949 !! test
950 Bug 4781, 5267: %26 in bracketed URL
951 !! input
952 [http://www.example.com/?title=100%25_Bran link]
953 !! result
954 <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>
955 </p>
956 !! end
957
958 !! test
959 Bug 4781, 5267: %28, %29 in bracketed URL
960 !! input
961 [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
962 !! result
963 <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>
964 </p>
965 !! end
966
967 !! test
968 External link containing double-single-quotes in text '' (bug 4598 sanity check)
969 !! input
970 Some [http://example.com/ pretty ''italics'' and stuff]!
971 !! result
972 <p>Some <a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow">pretty <i>italics</i> and stuff</a>!
973 </p>
974 !! end
975
976 !! test
977 External link containing double-single-quotes in text embedded in italics (bug 4598 sanity check)
978 !! input
979 ''Some [http://example.com/ pretty ''italics'' and stuff]!''
980 !! result
981 <p><i>Some </i><a href="http://example.com/" class="external text" title="http://example.com/" rel="nofollow"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
982 </p>
983 !! end
984
985
986
987 ###
988 ### Quotes
989 ###
990
991 !! test
992 Quotes
993 !! input
994 Normal text. '''Bold text.''' Normal text. ''Italic text.''
995
996 Normal text. '''''Bold italic text.''''' Normal text.
997 !!result
998 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
999 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
1000 </p>
1001 !! end
1002
1003
1004 !! test
1005 Unclosed and unmatched quotes
1006 !! input
1007 '''''Bold italic text '''with bold deactivated''' in between.'''''
1008
1009 '''''Bold italic text ''with italic deactivated'' in between.'''''
1010
1011 '''Bold text..
1012
1013 ..spanning two paragraphs (should not work).'''
1014
1015 '''Bold tag left open
1016
1017 ''Italic tag left open
1018
1019 Normal text.
1020
1021 <!-- Unmatching number of opening, closing tags: -->
1022 '''This year''''s election ''should'' beat '''last year''''s.
1023
1024 ''Tom'''s car is bigger than ''Susan'''s.
1025 !! result
1026 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
1027 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
1028 </p><p><b>Bold text..</b>
1029 </p><p>..spanning two paragraphs (should not work).
1030 </p><p><b>Bold tag left open</b>
1031 </p><p><i>Italic tag left open</i>
1032 </p><p>Normal text.
1033 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
1034 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
1035 </p>
1036 !! end
1037
1038 ###
1039 ### Tables
1040 ###
1041 ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
1042 ###
1043
1044 # This should not produce <table></table> as <table><tr><td></td></tr></table>
1045 # is the bare minimun required by the spec, see:
1046 # http://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
1047 !! test
1048 A table with no data.
1049 !! input
1050 {||}
1051 !! result
1052 !! end
1053
1054 # A table with nothing but a caption is invalid XHTML, we might want to render
1055 # this as <p>caption</p>
1056 !! test
1057 A table with nothing but a caption
1058 !! input
1059 {|
1060 |+ caption
1061 |}
1062 !! result
1063 <table>
1064 <caption> caption
1065 </caption><tr><td></td></tr></table>
1066
1067 !! end
1068
1069 !! test
1070 Simple table
1071 !! input
1072 {|
1073 | 1 || 2
1074 |-
1075 | 3 || 4
1076 |}
1077 !! result
1078 <table>
1079 <tr>
1080 <td> 1 </td><td> 2
1081 </td></tr>
1082 <tr>
1083 <td> 3 </td><td> 4
1084 </td></tr></table>
1085
1086 !! end
1087
1088 !! test
1089 Multiplication table
1090 !! input
1091 {| border="1" cellpadding="2"
1092 |+Multiplication table
1093 |-
1094 ! &times; !! 1 !! 2 !! 3
1095 |-
1096 ! 1
1097 | 1 || 2 || 3
1098 |-
1099 ! 2
1100 | 2 || 4 || 6
1101 |-
1102 ! 3
1103 | 3 || 6 || 9
1104 |-
1105 ! 4
1106 | 4 || 8 || 12
1107 |-
1108 ! 5
1109 | 5 || 10 || 15
1110 |}
1111 !! result
1112 <table border="1" cellpadding="2">
1113 <caption>Multiplication table
1114 </caption>
1115 <tr>
1116 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
1117 </th></tr>
1118 <tr>
1119 <th> 1
1120 </th><td> 1 </td><td> 2 </td><td> 3
1121 </td></tr>
1122 <tr>
1123 <th> 2
1124 </th><td> 2 </td><td> 4 </td><td> 6
1125 </td></tr>
1126 <tr>
1127 <th> 3
1128 </th><td> 3 </td><td> 6 </td><td> 9
1129 </td></tr>
1130 <tr>
1131 <th> 4
1132 </th><td> 4 </td><td> 8 </td><td> 12
1133 </td></tr>
1134 <tr>
1135 <th> 5
1136 </th><td> 5 </td><td> 10 </td><td> 15
1137 </td></tr></table>
1138
1139 !! end
1140
1141 !! test
1142 Table rowspan
1143 !! input
1144 {| align=right border=1
1145 | Cell 1, row 1
1146 |rowspan=2| Cell 2, row 1 (and 2)
1147 | Cell 3, row 1
1148 |-
1149 | Cell 1, row 2
1150 | Cell 3, row 2
1151 |}
1152 !! result
1153 <table align="right" border="1">
1154 <tr>
1155 <td> Cell 1, row 1
1156 </td><td rowspan="2"> Cell 2, row 1 (and 2)
1157 </td><td> Cell 3, row 1
1158 </td></tr>
1159 <tr>
1160 <td> Cell 1, row 2
1161 </td><td> Cell 3, row 2
1162 </td></tr></table>
1163
1164 !! end
1165
1166 !! test
1167 Nested table
1168 !! input
1169 {| border=1
1170 | &alpha;
1171 |
1172 {| bgcolor=#ABCDEF border=2
1173 |nested
1174 |-
1175 |table
1176 |}
1177 |the original table again
1178 |}
1179 !! result
1180 <table border="1">
1181 <tr>
1182 <td> &alpha;
1183 </td><td>
1184 <table bgcolor="#ABCDEF" border="2">
1185 <tr>
1186 <td>nested
1187 </td></tr>
1188 <tr>
1189 <td>table
1190 </td></tr></table>
1191 </td><td>the original table again
1192 </td></tr></table>
1193
1194 !! end
1195
1196 !! test
1197 Invalid attributes in table cell (bug 1830)
1198 !! input
1199 {|
1200 |Cell:|broken
1201 |}
1202 !! result
1203 <table>
1204 <tr>
1205 <td>broken
1206 </td></tr></table>
1207
1208 !! end
1209
1210
1211 # FIXME: this one has incorrect tag nesting still.
1212 !! test
1213 TODO: Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.html)
1214 !! input
1215 {|
1216 | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
1217 !! result
1218 <table>
1219 <tr>
1220 <td><a href="ftp://|x||" class="external autonumber" title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
1221 </td>
1222 </tr>
1223 </table>
1224
1225 !! end
1226
1227
1228 ###
1229 ### Internal links
1230 ###
1231 !! test
1232 Plain link, capitalized
1233 !! input
1234 [[Main Page]]
1235 !! result
1236 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1237 </p>
1238 !! end
1239
1240 !! test
1241 Plain link, uncapitalized
1242 !! input
1243 [[main Page]]
1244 !! result
1245 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
1246 </p>
1247 !! end
1248
1249 !! test
1250 Piped link
1251 !! input
1252 [[Main Page|The Main Page]]
1253 !! result
1254 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
1255 </p>
1256 !! end
1257
1258 !! test
1259 Broken link
1260 !! input
1261 [[Zigzagzogzagzig]]
1262 !! result
1263 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
1264 </p>
1265 !! end
1266
1267 !! test
1268 Link with prefix
1269 !! input
1270 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
1271 !! result
1272 <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>
1273 </p>
1274 !! end
1275
1276 !! test
1277 Link with suffix
1278 !! input
1279 [[Main Page]]xxx, [[Main Page]]XXX
1280 !! result
1281 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
1282 </p>
1283 !! end
1284
1285 !! test
1286 Link with 3 brackets
1287 !! input
1288 [[[main page]]]
1289 !! result
1290 <p>[[[main page]]]
1291 </p>
1292 !! end
1293
1294 !! test
1295 Piped link with 3 brackets
1296 !! input
1297 [[[main page|the main page]]]
1298 !! result
1299 <p>[[[main page|the main page]]]
1300 </p>
1301 !! end
1302
1303 !! test
1304 Link with multiple pipes
1305 !! input
1306 [[Main Page|The|Main|Page]]
1307 !! result
1308 <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
1309 </p>
1310 !! end
1311
1312 !! test
1313 Link to namespaces
1314 !! input
1315 [[Talk:Parser testing]], [[Meta:Disclaimers]]
1316 !! result
1317 <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>
1318 </p>
1319 !! end
1320
1321 !! test
1322 Piped link to namespace
1323 !! input
1324 [[Meta:Disclaimers|The disclaimers]]
1325 !! result
1326 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
1327 </p>
1328 !! end
1329
1330 !! test
1331 Link containing }
1332 !! input
1333 [[Usually caused by a typo (oops}]]
1334 !! result
1335 <p>[[Usually caused by a typo (oops}]]
1336 </p>
1337 !! end
1338
1339 !! test
1340 Link containing % (not as a hex sequence)
1341 !! input
1342 [[7% Solution]]
1343 !! result
1344 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1345 </p>
1346 !! end
1347
1348 !! test
1349 Link containing % as a single hex sequence interpreted to char
1350 !! input
1351 [[7%25 Solution]]
1352 !! result
1353 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
1354 </p>
1355 !!end
1356
1357 !! test
1358 Link containing % as a double hex sequence interpreted to hex sequence
1359 !! input
1360 [[7%2525 Solution]]
1361 !! result
1362 <p>[[7%2525 Solution]]
1363 </p>
1364 !!end
1365
1366 !! test
1367 Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
1368 Example for such a section: == < ==
1369 !! input
1370 [[%23%3c]][[%23%3e]]
1371 !! result
1372 <p><a href="#.3C" title="">#&lt;</a><a href="#.3E" title="">#&gt;</a>
1373 </p>
1374 !! end
1375
1376 !! test
1377 Link containing "<#" and ">#" as a hex sequences
1378 !! input
1379 [[%3c%23]][[%3e%23]]
1380 !! result
1381 <p>[[%3c%23]][[%3e%23]]
1382 </p>
1383 !! end
1384
1385 !! test
1386 TODO: Link containing double-single-quotes '' (bug 4598)
1387 !! input
1388 [[Lista d''e paise d''o munno]]
1389 !! result
1390 <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit" class="new" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a>
1391 </p>
1392 !! end
1393
1394 !! test
1395 Link containing double-single-quotes '' in text (bug 4598 sanity check)
1396 !! input
1397 Some [[Link|pretty ''italics'' and stuff]]!
1398 !! result
1399 <p>Some <a href="/index.php?title=Link&amp;action=edit" class="new" title="Link">pretty <i>italics</i> and stuff</a>!
1400 </p>
1401 !! end
1402
1403 !! test
1404 Link containing double-single-quotes '' in text embedded in italics (bug 4598 sanity check)
1405 !! input
1406 ''Some [[Link|pretty ''italics'' and stuff]]!
1407 !! result
1408 <p><i>Some </i><a href="/index.php?title=Link&amp;action=edit" class="new" title="Link"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
1409 </p>
1410 !! end
1411
1412 !! test
1413 Plain link to URL
1414 !! input
1415 [[http://www.example.org]]
1416 !! result
1417 <p>[<a href="http://www.example.org" class="external autonumber" title="http://www.example.org" rel="nofollow">[1]</a>]
1418 </p>
1419 !! end
1420
1421 # I'm fairly sure the expected result here is wrong.
1422 # We want these to be URL links, not pseudo-pages with URLs for titles....
1423 # However the current output is also pretty screwy.
1424 #
1425 # ----
1426 # I'm changing it to match the current output--it arguably makes more
1427 # sense in the light of the test above. Old expected result was:
1428 #<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>
1429 #</p>
1430 # But I think this test is bordering on "garbage in, garbage out" anyway.
1431 # -- wtm
1432 !! test
1433 Piped link to URL
1434 !! input
1435 Piped link to URL: [[http://www.example.org|an example URL]]
1436 !! result
1437 <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>]
1438 </p>
1439 !! end
1440
1441 !! test
1442 BUG 2: [[page|http://url/]] should link to page, not http://url/
1443 !! input
1444 [[Main Page|http://url/]]
1445 !! result
1446 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
1447 </p>
1448 !! end
1449
1450 !! test
1451 BUG 337: Escaped self-links should be bold
1452 !! options
1453 title=[[Bug462]]
1454 !! input
1455 [[Bu&#103;462]] [[Bug462]]
1456 !! result
1457 <p><strong class="selflink">Bu&#103;462</strong> <strong class="selflink">Bug462</strong>
1458 </p>
1459 !! end
1460
1461 !! test
1462 Self-link to section should not be bold
1463 !! options
1464 title=[[Main Page]]
1465 !! input
1466 [[Main Page#section]]
1467 !! result
1468 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
1469 </p>
1470 !! end
1471
1472 !! test
1473 <nowiki> inside a link
1474 !! input
1475 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1476 !! result
1477 <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1478 </p>
1479 !! end
1480
1481 ###
1482 ### Interwiki links (see maintenance/interwiki.sql)
1483 ###
1484
1485 !! test
1486 Inline interwiki link
1487 !! input
1488 [[MeatBall:SoftSecurity]]
1489 !! result
1490 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
1491 </p>
1492 !! end
1493
1494 !! test
1495 Inline interwiki link with empty title (bug 2372)
1496 !! input
1497 [[MeatBall:]]
1498 !! result
1499 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?" class="extiw" title="meatball:">MeatBall:</a>
1500 </p>
1501 !! end
1502
1503 !! test
1504 Interwiki link encoding conversion (bug 1636)
1505 !! input
1506 *[[Wikipedia:ro:Olteni&#0355;a]]
1507 *[[Wikipedia:ro:Olteni&#355;a]]
1508 !! result
1509 <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>
1510 </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>
1511 </li></ul>
1512
1513 !! end
1514
1515 !! test
1516 Interwiki link with fragment (bug 2130)
1517 !! input
1518 [[MeatBall:SoftSecurity#foo]]
1519 !! result
1520 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
1521 </p>
1522 !! end
1523
1524 ##
1525 ## XHTML tidiness
1526 ###
1527
1528 !! test
1529 <br> to <br />
1530 !! input
1531 1<br>2<br />3
1532 !! result
1533 <p>1<br />2<br />3
1534 </p>
1535 !! end
1536
1537 !! test
1538 Incorrecly removing closing slashes from correctly formed XHTML
1539 !! input
1540 <br style="clear:both;" />
1541 !! result
1542 <p><br style="clear:both;" />
1543 </p>
1544 !! end
1545
1546 !! test
1547 Failing to transform badly formed HTML into correct XHTML
1548 !! input
1549 <br clear=left>
1550 <br clear=right>
1551 <br clear=all>
1552 !! result
1553 <p><br clear="left" />
1554 <br clear="right" />
1555 <br clear="all" />
1556 </p>
1557 !!end
1558
1559 !! test
1560 Horizontal ruler (should it add that extra space?)
1561 !! input
1562 <hr>
1563 <hr >
1564 foo <hr
1565 > bar
1566 !! result
1567 <hr />
1568 <hr />
1569 foo <hr /> bar
1570
1571 !! end
1572
1573 ###
1574 ### Block-level elements
1575 ###
1576 !! test
1577 Common list
1578 !! input
1579 *Common list
1580 * item 2
1581 *item 3
1582 !! result
1583 <ul><li>Common list
1584 </li><li> item 2
1585 </li><li>item 3
1586 </li></ul>
1587
1588 !! end
1589
1590 !! test
1591 Numbered list
1592 !! input
1593 #Numbered list
1594 #item 2
1595 # item 3
1596 !! result
1597 <ol><li>Numbered list
1598 </li><li>item 2
1599 </li><li> item 3
1600 </li></ol>
1601
1602 !! end
1603
1604 !! test
1605 Mixed list
1606 !! input
1607 *Mixed list
1608 *# with numbers
1609 ** and bullets
1610 *# and numbers
1611 *bullets again
1612 **bullet level 2
1613 ***bullet level 3
1614 ***#Number on level 4
1615 **bullet level 2
1616 **#Number on level 3
1617 **#Number on level 3
1618 *#number level 2
1619 *Level 1
1620 !! result
1621 <ul><li>Mixed list
1622 <ol><li> with numbers
1623 </li></ol>
1624 <ul><li> and bullets
1625 </li></ul>
1626 <ol><li> and numbers
1627 </li></ol>
1628 </li><li>bullets again
1629 <ul><li>bullet level 2
1630 <ul><li>bullet level 3
1631 <ol><li>Number on level 4
1632 </li></ol>
1633 </li></ul>
1634 </li><li>bullet level 2
1635 <ol><li>Number on level 3
1636 </li><li>Number on level 3
1637 </li></ol>
1638 </li></ul>
1639 <ol><li>number level 2
1640 </li></ol>
1641 </li><li>Level 1
1642 </li></ul>
1643
1644 !! end
1645
1646 !! test
1647 List items are not parsed correctly following a <pre> block (bug 785)
1648 !! input
1649 * <pre>foo</pre>
1650 * <pre>bar</pre>
1651 * zar
1652 !! result
1653 <ul><li> <pre>foo</pre>
1654 </li><li> <pre>bar</pre>
1655 </li><li> zar
1656 </li></ul>
1657
1658 !! end
1659
1660 ###
1661 ### Magic Words
1662 ###
1663
1664 !! test
1665 Magic Word: {{CURRENTDAY}}
1666 !! input
1667 {{CURRENTDAY}}
1668 !! result
1669 <p>1
1670 </p>
1671 !! end
1672
1673 !! test
1674 Magic Word: {{CURRENTDAY2}}
1675 !! input
1676 {{CURRENTDAY2}}
1677 !! result
1678 <p>01
1679 </p>
1680 !! end
1681
1682 !! test
1683 Magic Word: {{CURRENTDAYNAME}}
1684 !! input
1685 {{CURRENTDAYNAME}}
1686 !! result
1687 <p>Thursday
1688 </p>
1689 !! end
1690
1691 !! test
1692 Magic Word: {{CURRENTDOW}}
1693 !! input
1694 {{CURRENTDOW}}
1695 !! result
1696 <p>4
1697 </p>
1698 !! end
1699
1700 !! test
1701 Magic Word: {{CURRENTMONTH}}
1702 !! input
1703 {{CURRENTMONTH}}
1704 !! result
1705 <p>01
1706 </p>
1707 !! end
1708
1709 !! test
1710 Magic Word: {{CURRENTMONTHABBREV}}
1711 !! input
1712 {{CURRENTMONTHABBREV}}
1713 !! result
1714 <p>Jan
1715 </p>
1716 !! end
1717
1718 !! test
1719 Magic Word: {{CURRENTMONTHNAME}}
1720 !! input
1721 {{CURRENTMONTHNAME}}
1722 !! result
1723 <p>January
1724 </p>
1725 !! end
1726
1727 !! test
1728 Magic Word: {{CURRENTMONTHNAMEGEN}}
1729 !! input
1730 {{CURRENTMONTHNAMEGEN}}
1731 !! result
1732 <p>January
1733 </p>
1734 !! end
1735
1736 !! test
1737 Magic Word: {{CURRENTTIME}}
1738 !! input
1739 {{CURRENTTIME}}
1740 !! result
1741 <p>00:02
1742 </p>
1743 !! end
1744
1745 !! test
1746 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1747 !! input
1748 {{CURRENTWEEK}}
1749 !! result
1750 <p>1
1751 </p>
1752 !! end
1753
1754 !! test
1755 Magic Word: {{CURRENTYEAR}}
1756 !! input
1757 {{CURRENTYEAR}}
1758 !! result
1759 <p>1970
1760 </p>
1761 !! end
1762
1763 !! test
1764 Magic Word: {{FULLPAGENAME}}
1765 !! options
1766 title=[[User:Ævar Arnfjörð Bjarmason]]
1767 !! input
1768 {{FULLPAGENAME}}
1769 !! result
1770 <p>User:Ævar Arnfjörð Bjarmason
1771 </p>
1772 !! end
1773
1774 !! test
1775 Magic Word: {{FULLPAGENAMEE}}
1776 !! options
1777 title=[[User:Ævar Arnfjörð Bjarmason]]
1778 !! input
1779 {{FULLPAGENAMEE}}
1780 !! result
1781 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1782 </p>
1783 !! end
1784
1785 !! test
1786 Magic Word: {{NAMESPACE}}
1787 !! options
1788 title=[[User:Ævar Arnfjörð Bjarmason]]
1789 disabled # FIXME
1790 !! input
1791 {{NAMESPACE}}
1792 !! result
1793 <p>User
1794 </p>
1795 !! end
1796
1797 !! test
1798 Magic Word: {{NAMESPACEE}}
1799 !! options
1800 title=[[User:Ævar Arnfjörð Bjarmason]]
1801 disabled # FIXME
1802 !! input
1803 {{NAMESPACEE}}
1804 !! result
1805 <p>User
1806 </p>
1807 !! end
1808
1809 !! test
1810 Magic Word: {{NUMBEROFARTICLES}}
1811 !! input
1812 {{NUMBEROFARTICLES}}
1813 !! result
1814 <p>1
1815 </p>
1816 !! end
1817
1818 !! test
1819 Magic Word: {{NUMBEROFFILES}}
1820 !! input
1821 {{NUMBEROFFILES}}
1822 !! result
1823 <p>1
1824 </p>
1825 !! end
1826
1827 !! test
1828 Magic Word: {{PAGENAME}}
1829 !! options
1830 title=[[User:Ævar Arnfjörð Bjarmason]]
1831 disabled # FIXME
1832 !! input
1833 {{PAGENAME}}
1834 !! result
1835 <p>Ævar Arnfjörð Bjarmason
1836 </p>
1837 !! end
1838
1839 !! test
1840 Magic Word: {{PAGENAMEE}}
1841 !! options
1842 title=[[User:Ævar Arnfjörð Bjarmason]]
1843 !! input
1844 {{PAGENAMEE}}
1845 !! result
1846 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1847 </p>
1848 !! end
1849
1850 !! test
1851 Magic Word: {{REVISIONID}}
1852 !! input
1853 {{REVISIONID}}
1854 !! result
1855 <p>1337
1856 </p>
1857 !! end
1858
1859 !! test
1860 Magic Word: {{SCRIPTPATH}}
1861 !! input
1862 {{SCRIPTPATH}}
1863 !! result
1864 <p>/
1865 </p>
1866 !! end
1867
1868 !! test
1869 Magic Word: {{SERVER}}
1870 !! input
1871 {{SERVER}}
1872 !! result
1873 <p><a href="http://localhost" class="external free" title="http://localhost" rel="nofollow">http://localhost</a>
1874 </p>
1875 !! end
1876
1877 !! test
1878 Magic Word: {{SERVERNAME}}
1879 !! input
1880 {{SERVERNAME}}
1881 !! result
1882 <p>Britney Spears
1883 </p>
1884 !! end
1885
1886 !! test
1887 Magic Word: {{SITENAME}}
1888 !! input
1889 {{SITENAME}}
1890 !! result
1891 <p>MediaWiki
1892 </p>
1893 !! end
1894
1895 !! test
1896 Namespace 1 {{ns:1}}
1897 !! input
1898 {{ns:1}}
1899 !! result
1900 <p>Talk
1901 </p>
1902 !! end
1903
1904 !! test
1905 Namespace 1 {{ns:01}}
1906 !! input
1907 {{ns:01}}
1908 !! result
1909 <p>Talk
1910 </p>
1911 !! end
1912
1913 !! test
1914 Namespace 0 {{ns:0}} (bug 4783)
1915 !! input
1916 {{ns:0}}
1917 !! result
1918
1919 !! end
1920
1921 !! test
1922 Namespace 0 {{ns:00}} (bug 4783)
1923 !! input
1924 {{ns:00}}
1925 !! result
1926
1927 !! end
1928
1929 !! test
1930 Namespace -1 {{ns:-1}}
1931 !! input
1932 {{ns:-1}}
1933 !! result
1934 <p>Special
1935 </p>
1936 !! end
1937
1938 !! test
1939 Namespace Project {{ns:User}}
1940 !! input
1941 {{ns:User}}
1942 !! result
1943 <p>User
1944 </p>
1945 !! end
1946
1947
1948 ###
1949 ### Magic links
1950 ###
1951 !! test
1952 Magic links: internal link to RFC (bug 479)
1953 !! input
1954 [[RFC 123]]
1955 !! result
1956 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1957 </p>
1958 !! end
1959
1960 !! test
1961 Magic links: RFC (bug 479)
1962 !! input
1963 RFC 822
1964 !! result
1965 <p><a href="http://www.ietf.org/rfc/rfc822.txt" class="external" title="http://www.ietf.org/rfc/rfc822.txt">RFC 822</a>
1966 </p>
1967 !! end
1968
1969 !! test
1970 Magic links: ISBN (bug 1937)
1971 !! input
1972 ISBN 0-306-40615-2
1973 !! result
1974 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1975 </p>
1976 !! end
1977
1978 !! test
1979 Magic links: PMID incorrectly converts space to underscore
1980 !! input
1981 PMID 1234
1982 !! result
1983 <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>
1984 </p>
1985 !! end
1986
1987 ###
1988 ### Templates
1989 ####
1990
1991 !! test
1992 Nonexistant template
1993 !! input
1994 {{thistemplatedoesnotexist}}
1995 !! result
1996 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1997 </p>
1998 !! end
1999
2000 !! article
2001 Template:test
2002 !! text
2003 This is a test template
2004 !! endarticle
2005
2006 !! test
2007 Simple template
2008 !! input
2009 {{test}}
2010 !! result
2011 <p>This is a test template
2012 </p>
2013 !! end
2014
2015 !! test
2016 Template with explicit namespace
2017 !! input
2018 {{Template:test}}
2019 !! result
2020 <p>This is a test template
2021 </p>
2022 !! end
2023
2024
2025 !! article
2026 Template:paramtest
2027 !! text
2028 This is a test template with parameter {{{param}}}
2029 !! endarticle
2030
2031 !! test
2032 Template parameter
2033 !! input
2034 {{paramtest|param=foo}}
2035 !! result
2036 <p>This is a test template with parameter foo
2037 </p>
2038 !! end
2039
2040 !! article
2041 Template:paramtestnum
2042 !! text
2043 [[{{{1}}}|{{{2}}}]]
2044 !! endarticle
2045
2046 !! test
2047 Template unnamed parameter
2048 !! input
2049 {{paramtestnum|Main Page|the main page}}
2050 !! result
2051 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2052 </p>
2053 !! end
2054
2055 !! article
2056 Template:templatesimple
2057 !! text
2058 (test)
2059 !! endarticle
2060
2061 !! article
2062 Template:templateredirect
2063 !! text
2064 #redirect [[Template:templatesimple]]
2065 !! endarticle
2066
2067 !! article
2068 Template:templateasargtestnum
2069 !! text
2070 {{{{{1}}}}}
2071 !! endarticle
2072
2073 !! article
2074 Template:templateasargtest
2075 !! text
2076 {{template{{{templ}}}}}
2077 !! endarticle
2078
2079 !! article
2080 Template:templateasargtest2
2081 !! text
2082 {{{{{templ}}}}}
2083 !! endarticle
2084
2085 !! test
2086 Template with template name as unnamed argument
2087 !! input
2088 {{templateasargtestnum|templatesimple}}
2089 !! result
2090 <p>(test)
2091 </p>
2092 !! end
2093
2094 !! test
2095 Template with template name as argument
2096 !! input
2097 {{templateasargtest|templ=simple}}
2098 !! result
2099 <p>(test)
2100 </p>
2101 !! end
2102
2103 !! test
2104 Template with template name as argument (2)
2105 !! input
2106 {{templateasargtest2|templ=templatesimple}}
2107 !! result
2108 <p>(test)
2109 </p>
2110 !! end
2111
2112 !! article
2113 Template:templateasargtestdefault
2114 !! text
2115 {{{{{templ|templatesimple}}}}}
2116 !! endarticle
2117
2118 !! article
2119 Template:templa
2120 !! text
2121 '''templ'''
2122 !! endarticle
2123
2124 !! test
2125 Template with default value
2126 !! input
2127 {{templateasargtestdefault}}
2128 !! result
2129 <p>(test)
2130 </p>
2131 !! end
2132
2133 !! test
2134 Template with default value (value set)
2135 !! input
2136 {{templateasargtestdefault|templ=templa}}
2137 !! result
2138 <p><b>templ</b>
2139 </p>
2140 !! end
2141
2142 !! test
2143 Template redirect
2144 !! input
2145 {{templateredirect}}
2146 !! result
2147 <p>(test)
2148 </p>
2149 !! end
2150
2151 !! test
2152 Template with argument in separate line
2153 !! input
2154 {{ templateasargtest |
2155 templ = simple }}
2156 !! result
2157 <p>(test)
2158 </p>
2159 !! end
2160
2161 !! test
2162 Template with complex template as argument
2163 !! input
2164 {{paramtest|
2165 param ={{ templateasargtest |
2166 templ = simple }}}}
2167 !! result
2168 <p>This is a test template with parameter (test)
2169 </p>
2170 !! end
2171
2172 !! test
2173 TODO: Template with thumb image (with link in description)
2174 !! input
2175 {{paramtest|
2176 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2177 !! result
2178 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>
2179
2180 !! end
2181
2182 !! article
2183 Template:complextemplate
2184 !! text
2185 {{{1}}} {{paramtest|
2186 param ={{{param}}}}}
2187 !! endarticle
2188
2189 !! test
2190 Template with complex arguments
2191 !! input
2192 {{complextemplate|
2193 param ={{ templateasargtest |
2194 templ = simple }}|[[Template:complextemplate|link]]}}
2195 !! result
2196 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2197 </p>
2198 !! end
2199
2200 !! test
2201 BUG 553: link with two variables in a piped link
2202 !! input
2203 {|
2204 |[[{{{1}}}|{{{2}}}]]
2205 |}
2206 !! result
2207 <table>
2208 <tr>
2209 <td>[[{{{1}}}|{{{2}}}]]
2210 </td></tr></table>
2211
2212 !! end
2213
2214 !! test
2215 Magic variable as template parameter
2216 !! input
2217 {{paramtest|param={{SITENAME}}}}
2218 !! result
2219 <p>This is a test template with parameter MediaWiki
2220 </p>
2221 !! end
2222
2223 !! article
2224 Template:linktest
2225 !! text
2226 [[{{{param}}}|link]]
2227 !! endarticle
2228
2229 !! test
2230 Template parameter as link source
2231 !! input
2232 {{linktest|param=Main Page}}
2233 !! result
2234 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2235 </p>
2236 !! end
2237
2238
2239 !!article
2240 Template:paramtest2
2241 !! text
2242 including another template, {{paramtest|param={{{arg}}}}}
2243 !! endarticle
2244
2245 !! test
2246 Template passing argument to another template
2247 !! input
2248 {{paramtest2|arg='hmm'}}
2249 !! result
2250 <p>including another template, This is a test template with parameter 'hmm'
2251 </p>
2252 !! end
2253
2254 !! article
2255 Template:Linktest2
2256 !! text
2257 Main Page
2258 !! endarticle
2259
2260 !! test
2261 Template as link source
2262 !! input
2263 [[{{linktest2}}]]
2264 !! result
2265 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2266 </p>
2267 !! end
2268
2269
2270 !! article
2271 Template:loop1
2272 !! text
2273 {{loop2}}
2274 !! endarticle
2275
2276 !! article
2277 Template:loop2
2278 !! text
2279 {{loop1}}
2280 !! endarticle
2281
2282 !! test
2283 Template infinite loop
2284 !! input
2285 {{loop1}}
2286 !! result
2287 <p>{{loop1}}<!-- WARNING: template loop detected -->
2288 </p>
2289 !! end
2290
2291 !! test
2292 Template from main namespace
2293 !! input
2294 {{:Main Page}}
2295 !! result
2296 <p>blah blah
2297 </p>
2298 !! end
2299
2300 !! article
2301 Template:table
2302 !! text
2303 {|
2304 | 1 || 2
2305 |-
2306 | 3 || 4
2307 |}
2308 !! endarticle
2309
2310 !! test
2311 BUG 529: Template with table, not included at beginning of line
2312 !! input
2313 foo {{table}}
2314 !! result
2315 <p>foo
2316 </p>
2317 <table>
2318 <tr>
2319 <td> 1 </td><td> 2
2320 </td></tr>
2321 <tr>
2322 <td> 3 </td><td> 4
2323 </td></tr></table>
2324
2325 !! end
2326
2327 !! test
2328 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2329 !! input
2330 foo
2331 {{table}}
2332 !! result
2333 <p>foo
2334 </p>
2335 <table>
2336 <tr>
2337 <td> 1 </td><td> 2
2338 </td></tr>
2339 <tr>
2340 <td> 3 </td><td> 4
2341 </td></tr></table>
2342
2343 !! end
2344
2345 !! test
2346 BUG 41: Template parameters shown as broken links
2347 !! input
2348 {{{parameter}}}
2349 !! result
2350 <p>{{{parameter}}}
2351 </p>
2352 !! end
2353
2354
2355 !! article
2356 Template:MSGNW test
2357 !! text
2358 ''None'' of '''this''' should be
2359 * interepreted
2360 but rather passed unmodified
2361 {{test}}
2362 !! endarticle
2363
2364 # hmm, fix this or just deprecate msgnw and document its behavior?
2365 !! test
2366 msgnw keyword
2367 !! options
2368 disabled
2369 !! input
2370 {{msgnw:MSGNW test}}
2371 !! result
2372 <p>''None'' of '''this''' should be
2373 * interepreted
2374 but rather passed unmodified
2375 {{test}}
2376 </p>
2377 !! end
2378
2379 !! test
2380 int keyword
2381 !! input
2382 {{int:youhavenewmessages|lots of money|not!}}
2383 !! result
2384 <p>You have lots of money (not!).
2385 </p>
2386 !! end
2387
2388 !! article
2389 Template:Includes
2390 !! text
2391 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2392 !! endarticle
2393
2394 !! test
2395 <includeonly> and <noinclude> being included
2396 !! input
2397 {{Includes}}
2398 !! result
2399 <p>Foobar
2400 </p>
2401 !! end
2402
2403 !! article
2404 Template:Includes2
2405 !! text
2406 <onlyinclude>Foo</onlyinclude>bar
2407 !! endarticle
2408
2409 !! test
2410 <onlyinclude> being included
2411 !! input
2412 {{Includes2}}
2413 !! result
2414 <p>Foo
2415 </p>
2416 !! end
2417
2418
2419 !! article
2420 Template:Includes3
2421 !! text
2422 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2423 !! endarticle
2424
2425 !! test
2426 <onlyinclude> and <includeonly> being included
2427 !! input
2428 {{Includes3}}
2429 !! result
2430 <p>Foo
2431 </p>
2432 !! end
2433
2434 !! test
2435 <includeonly> and <noinclude> on a page
2436 !! input
2437 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2438 !! result
2439 <p>Foozar
2440 </p>
2441 !! end
2442
2443 !! test
2444 <onlyinclude> on a page
2445 !! input
2446 <onlyinclude>Foo</onlyinclude>bar
2447 !! result
2448 <p>Foobar
2449 </p>
2450 !! end
2451
2452 ###
2453 ### Pre-save transform tests
2454 ###
2455 !! test
2456 pre-save transform: subst:
2457 !! options
2458 PST
2459 !! input
2460 {{subst:test}}
2461 !! result
2462 This is a test template
2463 !! end
2464
2465 !! test
2466 pre-save transform: normal template
2467 !! options
2468 PST
2469 !! input
2470 {{test}}
2471 !! result
2472 {{test}}
2473 !! end
2474
2475 !! test
2476 pre-save transform: nonexistant template
2477 !! options
2478 PST
2479 !! input
2480 {{thistemplatedoesnotexist}}
2481 !! result
2482 {{thistemplatedoesnotexist}}
2483 !! end
2484
2485
2486 !! test
2487 pre-save transform: subst magic variables
2488 !! options
2489 PST
2490 !! input
2491 {{subst:SITENAME}}
2492 !! result
2493 MediaWiki
2494 !! end
2495
2496 # This is bug 89, which I fixed. -- wtm
2497 !! test
2498 pre-save transform: subst: templates with parameters
2499 !! options
2500 pst
2501 !! input
2502 {{subst:paramtest|param="something else"}}
2503 !! result
2504 This is a test template with parameter "something else"
2505 !! end
2506
2507 !! article
2508 Template:nowikitest
2509 !! text
2510 <nowiki>'''not wiki'''</nowiki>
2511 !! endarticle
2512
2513 !! test
2514 pre-save transform: nowiki in subst (bug 1188)
2515 !! options
2516 pst
2517 !! input
2518 {{subst:nowikitest}}
2519 !! result
2520 <nowiki>'''not wiki'''</nowiki>
2521 !! end
2522
2523
2524 !! article
2525 Template:commenttest
2526 !! text
2527 This template has <!-- a comment --> in it.
2528 !! endarticle
2529
2530 !! test
2531 pre-save transform: comment in subst (bug 1936)
2532 !! options
2533 pst
2534 !! input
2535 {{subst:commenttest}}
2536 !! result
2537 This template has <!-- a comment --> in it.
2538 !! end
2539
2540 !! test
2541 pre-save transform: unclosed tag
2542 !! options
2543 pst noxml
2544 !! input
2545 <nowiki>'''not wiki'''
2546 !! result
2547 <nowiki>'''not wiki'''
2548 !! end
2549
2550 !! test
2551 pre-save transform: mixed tag case
2552 !! options
2553 pst noxml
2554 !! input
2555 <NOwiki>'''not wiki'''</noWIKI>
2556 !! result
2557 <NOwiki>'''not wiki'''</noWIKI>
2558 !! end
2559
2560 !! test
2561 pre-save transform: unclosed comment in <nowiki>
2562 !! options
2563 pst noxml
2564 !! input
2565 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2566 !! result
2567 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2568 !!end
2569
2570 !! article
2571 Template:dangerous
2572 !!text
2573 <span onmouseover="alert('crap')">Oh no</span>
2574 !!endarticle
2575
2576 !!test
2577 (confirming safety of fix for subst bug 1936)
2578 !! input
2579 {{Template:dangerous}}
2580 !! result
2581 <p><span>Oh no</span>
2582 </p>
2583 !! end
2584
2585 !! test
2586 pre-save transform: comment containing gallery (bug 5024)
2587 !! options
2588 pst
2589 !! input
2590 <!-- <gallery>data</gallery> -->
2591 !!result
2592 <!-- <gallery>data</gallery> -->
2593 !!end
2594
2595 !! test
2596 pre-save transform: comment containing extension
2597 !! options
2598 pst
2599 !! input
2600 <!-- <tag>data</tag> -->
2601 !!result
2602 <!-- <tag>data</tag> -->
2603 !!end
2604
2605 !! test
2606 pre-save transform: comment containing nowiki
2607 !! options
2608 pst
2609 !! input
2610 <!-- <nowiki>data</nowiki> -->
2611 !!result
2612 <!-- <nowiki>data</nowiki> -->
2613 !!end
2614
2615 !! test
2616 pre-save transform: comment containing math
2617 !! options
2618 pst
2619 !! input
2620 <!-- <math>data</math> -->
2621 !!result
2622 <!-- <math>data</math> -->
2623 !!end
2624
2625 !! test
2626 pre-save transform: <noinclude> in subst (bug 3298)
2627 !! options
2628 pst
2629 !! input
2630 {{subst:Includes}}
2631 !! result
2632 Foobar
2633 !! end
2634
2635 !! test
2636 pre-save transform: <onlyinclude> in subst (bug 3298)
2637 !! options
2638 pst
2639 !! input
2640 {{subst:Includes2}}
2641 !! result
2642 Foo
2643 !! end
2644
2645 !! test
2646 pre-save transform: context links ("pipe trick")
2647 !! options
2648 pst
2649 !! input
2650 [[Article (context)|]]
2651 [[Bar:Article|]]
2652 [[:Bar:Article|]]
2653 [[Bar:Article (context)|]]
2654 [[:Bar:Article (context)|]]
2655 [[|Article]]
2656 [[|Article (context)]]
2657 [[Bar:X (Y) Z|]]
2658 [[:Bar:X (Y) Z|]]
2659 !! result
2660 [[Article (context)|Article]]
2661 [[Bar:Article|Article]]
2662 [[:Bar:Article|Article]]
2663 [[Bar:Article (context)|Article]]
2664 [[:Bar:Article (context)|Article]]
2665 [[Article]]
2666 [[Article (context)]]
2667 [[Bar:X (Y) Z|X (Y) Z]]
2668 [[:Bar:X (Y) Z|X (Y) Z]]
2669 !! end
2670
2671 !! test
2672 pre-save transform: context links ("pipe trick") with interwiki prefix
2673 !! options
2674 pst
2675 !! input
2676 [[interwiki:Article|]]
2677 [[:interwiki:Article|]]
2678 [[interwiki:Bar:Article|]]
2679 [[:interwiki:Bar:Article|]]
2680 !! result
2681 [[interwiki:Article|Article]]
2682 [[:interwiki:Article|Article]]
2683 [[interwiki:Bar:Article|Bar:Article]]
2684 [[:interwiki:Bar:Article|Bar:Article]]
2685 !! end
2686
2687 !! test
2688 pre-save transform: context links ("pipe trick") with parens in title
2689 !! options
2690 pst title=[[Somearticle (context)]]
2691 !! input
2692 [[|Article]]
2693 !! result
2694 [[Article (context)|Article]]
2695 !! end
2696
2697 !! test
2698 pre-save transform: context links ("pipe trick") with comma in title
2699 !! options
2700 pst title=[[Someplace, Somewhere]]
2701 !! input
2702 [[|Otherplace]]
2703 [[Otherplace, Elsewhere|]]
2704 [[Otherplace, Elsewhere, Anywhere|]]
2705 !! result
2706 [[Otherplace, Somewhere|Otherplace]]
2707 [[Otherplace, Elsewhere|Otherplace]]
2708 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
2709 !! end
2710
2711 !! test
2712 pre-save transform: context links ("pipe trick") with parens and comma
2713 !! options
2714 pst title=[[Someplace (IGNORED), Somewhere]]
2715 !! input
2716 [[|Otherplace]]
2717 [[Otherplace (place), Elsewhere|]]
2718 !! result
2719 [[Otherplace, Somewhere|Otherplace]]
2720 [[Otherplace (place), Elsewhere|Otherplace]]
2721 !! end
2722
2723 !! test
2724 pre-save transform: context links ("pipe trick") with comma and parens
2725 !! options
2726 pst title=[[Who, me? (context)]]
2727 !! input
2728 [[|Yes, you.]]
2729 [[Me, Myself, and I (1937 song)|]]
2730 !! result
2731 [[Yes, you. (context)|Yes, you.]]
2732 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
2733 !! end
2734
2735 !! test
2736 pre-save transform: context links ("pipe trick") with namespace
2737 !! options
2738 pst title=[[Ns:Somearticle]]
2739 !! input
2740 [[|Article]]
2741 !! result
2742 [[Ns:Article|Article]]
2743 !! end
2744
2745 !! test
2746 pre-save transform: context links ("pipe trick") with namespace and parens
2747 !! options
2748 pst title=[[Ns:Somearticle (context)]]
2749 !! input
2750 [[|Article]]
2751 !! result
2752 [[Ns:Article (context)|Article]]
2753 !! end
2754
2755 !! test
2756 pre-save transform: context links ("pipe trick") with namespace and comma
2757 !! options
2758 pst title=[[Ns:Somearticle, Context, Whatever]]
2759 !! input
2760 [[|Article]]
2761 !! result
2762 [[Ns:Article, Context, Whatever|Article]]
2763 !! end
2764
2765 !! test
2766 pre-save transform: context links ("pipe trick") with namespace, comma and parens
2767 !! options
2768 pst title=[[Ns:Somearticle, Context (context)]]
2769 !! input
2770 [[|Article]]
2771 !! result
2772 [[Ns:Article (context)|Article]]
2773 !! end
2774
2775 !! test
2776 pre-save transform: context links ("pipe trick") with namespace, parens and comma
2777 !! options
2778 pst title=[[Ns:Somearticle (IGNORED), Context]]
2779 !! input
2780 [[|Article]]
2781 !! result
2782 [[Ns:Article, Context|Article]]
2783 !! end
2784
2785
2786 ###
2787 ### Message transform tests
2788 ###
2789 !! test
2790 message transform: magic variables
2791 !! options
2792 msg
2793 !! input
2794 {{SITENAME}}
2795 !! result
2796 MediaWiki
2797 !! end
2798
2799 !! test
2800 message transform: should not transform wiki markup
2801 !! options
2802 msg
2803 !! input
2804 ''test''
2805 !! result
2806 ''test''
2807 !! end
2808
2809 !! test
2810 TODO: message transform: <noinclude> in transcluded template (bug 4926)
2811 !! options
2812 msg
2813 !! input
2814 {{Includes}}
2815 !! result
2816 Foobar
2817 !! end
2818
2819 !! test
2820 TODO: message transform: <onlyinclude> in transcluded template (bug 4926)
2821 !! options
2822 msg
2823 !! input
2824 {{Includes2}}
2825 !! result
2826 Foo
2827 !! end
2828
2829
2830 ###
2831 ### Images
2832 ###
2833 !! test
2834 Simple image
2835 !! input
2836 [[Image:foobar.jpg]]
2837 !! result
2838 <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>
2839 </p>
2840 !! end
2841
2842 !! test
2843 Right-aligned image
2844 !! input
2845 [[Image:foobar.jpg|right]]
2846 !! result
2847 <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>
2848
2849 !! end
2850
2851 !! test
2852 Image with caption
2853 !! input
2854 [[Image:foobar.jpg|right|Caption text]]
2855 !! result
2856 <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>
2857
2858 !! end
2859
2860 !! test
2861 Image with frame and link
2862 !! input
2863 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2864 !! result
2865 <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>
2866
2867 !! end
2868
2869 !! test
2870 Link to image page- image page normally doesn't exists, hence edit link
2871 TODO: Add test with existing image page
2872 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2873 !! input
2874 [[:Image:test]]
2875 !! result
2876 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2877 </p>
2878 !! end
2879
2880 !! test
2881 Frameless image caption with a free URL
2882 !! input
2883 [[Image:foobar.jpg|http://example.com]]
2884 !! result
2885 <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>
2886 </p>
2887 !! end
2888
2889 !! test
2890 Thumbnail image caption with a free URL
2891 !! input
2892 [[Image:foobar.jpg|thumb|http://example.com]]
2893 !! result
2894 <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>
2895
2896 !! end
2897
2898 !! test
2899 BUG 1887: A ISBN with a thumbnail
2900 !! input
2901 [[Image:foobar.jpg|thumb|ISBN 12354]]
2902 !! result
2903 <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>
2904
2905 !! end
2906
2907 !! test
2908 BUG 1887: A RFC with a thumbnail
2909 !! input
2910 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2911 !! result
2912 <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>
2913
2914 !! end
2915
2916 !! test
2917 BUG 1887: A mailto link with a thumbnail
2918 !! input
2919 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2920 !! result
2921 <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>
2922
2923 !! end
2924
2925 !! test
2926 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2927 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2928 !! input
2929 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2930 !! result
2931 <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>
2932
2933 !! end
2934
2935 !! test
2936 BUG 1887, part 2: A <math> with a thumbnail- math enabled
2937 !! options
2938 math
2939 !! input
2940 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2941 !! result
2942 <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>
2943
2944 !! end
2945
2946 # Pending resolution to bug 368
2947 !! test
2948 BUG 648: Frameless image caption with a link
2949 !! input
2950 [[Image:foobar.jpg|text with a [[link]] in it]]
2951 !! result
2952 <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>
2953 </p>
2954 !! end
2955
2956 !! test
2957 BUG 648: Frameless image caption with a link (suffix)
2958 !! input
2959 [[Image:foobar.jpg|text with a [[link]]foo in it]]
2960 !! result
2961 <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>
2962 </p>
2963 !! end
2964
2965 !! test
2966 BUG 648: Frameless image caption with an interwiki link
2967 !! input
2968 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
2969 !! result
2970 <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>
2971 </p>
2972 !! end
2973
2974 !! test
2975 BUG 648: Frameless image caption with a piped interwiki link
2976 !! input
2977 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
2978 !! result
2979 <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>
2980 </p>
2981 !! end
2982
2983 !! test
2984 Escape HTML special chars in image alt text
2985 !! input
2986 [[Image:foobar.jpg|& < > "]]
2987 !! result
2988 <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>
2989 </p>
2990 !! end
2991
2992 !! test
2993 BUG 499: Alt text should have &#1234;, not &amp;1234;
2994 !! input
2995 [[Image:foobar.jpg|&#9792;]]
2996 !! result
2997 <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>
2998 </p>
2999 !! end
3000
3001 !! test
3002 Broken image caption with link
3003 !! input
3004 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3005 !! result
3006 <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.
3007 </p>
3008 !! end
3009
3010 !! test
3011 Image caption containing another image
3012 !! input
3013 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3014 !! result
3015 <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>
3016
3017 !! end
3018
3019 !! test
3020 Image caption containing a newline
3021 !! input
3022 [[Image:Foobar.jpg|This
3023 *is some text]]
3024 !! result
3025 <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>
3026 </p>
3027 !!end
3028
3029
3030 !! test
3031 Bug 3090: External links other than http: in image captions
3032 !! input
3033 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3034 !! result
3035 <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>
3036
3037 !! end
3038
3039
3040 ###
3041 ### Subpages
3042 ###
3043 !! article
3044 Subpage test/subpage
3045 !! text
3046 foo
3047 !! endarticle
3048
3049 !! test
3050 Subpage link
3051 !! options
3052 subpage title=[[Subpage test]]
3053 !! input
3054 [[/subpage]]
3055 !! result
3056 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3057 </p>
3058 !! end
3059
3060 !! test
3061 Subpage noslash link
3062 !! options
3063 subpage title=[[Subpage test]]
3064 !!input
3065 [[/subpage/]]
3066 !! result
3067 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3068 </p>
3069 !! end
3070
3071 !! test
3072 Disabled subpages
3073 !! input
3074 [[/subpage]]
3075 !! result
3076 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
3077 </p>
3078 !! end
3079
3080 !! test
3081 BUG 561: {{/Subpage}}
3082 !! options
3083 subpage title=[[Page]]
3084 !! input
3085 {{/Subpage}}
3086 !! result
3087 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
3088 </p>
3089 !! end
3090
3091 ###
3092 ### Categories
3093 ###
3094 !! article
3095 Category:MediaWiki User's Guide
3096 !! text
3097 blah
3098 !! endarticle
3099
3100 !! test
3101 Link to category
3102 !! input
3103 [[:Category:MediaWiki User's Guide]]
3104 !! result
3105 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3106 </p>
3107 !! end
3108
3109 !! test
3110 Simple category
3111 !! options
3112 cat
3113 !! input
3114 [[Category:MediaWiki User's Guide]]
3115 !! result
3116 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3117 !! end
3118
3119 ###
3120 ### Inter-language links
3121 ###
3122 !! test
3123 Inter-language links
3124 !! options
3125 ill
3126 !! input
3127 [[es:Alimento]]
3128 [[fr:Nourriture]]
3129 [[zh:&#39135;&#21697;]]
3130 !! result
3131 es:Alimento fr:Nourriture zh:食品
3132 !! end
3133
3134 ###
3135 ### Sections
3136 ###
3137 !! test
3138 Basic section headings
3139 !! options
3140 title=[[Parser test script]]
3141 !! input
3142 == Headline 1 ==
3143 Some text
3144
3145 ==Headline 2==
3146 More
3147 ===Smaller headline===
3148 Blah blah
3149 !! result
3150 <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>
3151 <p>Some text
3152 </p>
3153 <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>
3154 <p>More
3155 </p>
3156 <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>
3157 <p>Blah blah
3158 </p>
3159 !! end
3160
3161 !! test
3162 Section headings with TOC
3163 !! options
3164 title=[[Parser test script]]
3165 !! input
3166 == Headline 1 ==
3167 === Subheadline 1 ===
3168 ===== Skipping a level =====
3169 ====== Skipping a level ======
3170
3171 == Headline 2 ==
3172 Some text
3173 ===Another headline===
3174 !! result
3175 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3176 <ul>
3177 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3178 <ul>
3179 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3180 <ul>
3181 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3182 <ul>
3183 <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>
3184 </ul>
3185 </li>
3186 </ul>
3187 </li>
3188 </ul>
3189 </li>
3190 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3191 <ul>
3192 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3193 </ul>
3194 </li>
3195 </ul>
3196 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3197 <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>
3198 <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>
3199 <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>
3200 <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>
3201 <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>
3202 <p>Some text
3203 </p>
3204 <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>
3205
3206 !! end
3207
3208 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3209 !! test
3210 Handling of sections up to level 6 and beyond
3211 !! input
3212 = Level 1 Heading=
3213 == Level 2 Heading==
3214 === Level 3 Heading===
3215 ==== Level 4 Heading====
3216 ===== Level 5 Heading=====
3217 ====== Level 6 Heading======
3218 ======= Level 7 Heading=======
3219 ======== Level 8 Heading========
3220 ========= Level 9 Heading=========
3221 ========== Level 10 Heading==========
3222 !! result
3223 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3224 <ul>
3225 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3226 <ul>
3227 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3228 <ul>
3229 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3230 <ul>
3231 <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>
3232 <ul>
3233 <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>
3234 <ul>
3235 <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>
3236 <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>
3237 <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>
3238 <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>
3239 <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>
3240 </ul>
3241 </li>
3242 </ul>
3243 </li>
3244 </ul>
3245 </li>
3246 </ul>
3247 </li>
3248 </ul>
3249 </li>
3250 </ul>
3251 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3252 <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>
3253 <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>
3254 <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>
3255 <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>
3256 <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>
3257 <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>
3258 <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>
3259 <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>
3260 <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>
3261 <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>
3262
3263 !! end
3264
3265 !! test
3266 Resolving duplicate section names
3267 !! options
3268 title=[[Parser test script]]
3269 !! input
3270 == Foo bar ==
3271 == Foo bar ==
3272 !! result
3273 <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>
3274 <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>
3275
3276 !! end
3277
3278 !! article
3279 Template:sections
3280 !! text
3281 ===Section 1===
3282 ==Section 2==
3283 !! endarticle
3284
3285 !! test
3286 Template with sections, __NOTOC__
3287 !! options
3288 title=[[Parser test script]]
3289 !! input
3290 __NOTOC__
3291 ==Section 0==
3292 {{sections}}
3293 ==Section 4==
3294 !! result
3295 <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>
3296 <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>
3297 <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>
3298 <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>
3299
3300 !! end
3301
3302 !! test
3303 __NOEDITSECTION__ keyword
3304 !! input
3305 __NOEDITSECTION__
3306 ==Section 1==
3307 ==Section 2==
3308 !! result
3309 <a name="Section_1"></a><h2>Section 1</h2>
3310 <a name="Section_2"></a><h2>Section 2</h2>
3311
3312 !! end
3313
3314 !! test
3315 Link inside a section heading
3316 !! options
3317 title=[[Parser test script]]
3318 !! input
3319 ==Section with a [[Main Page|link]] in it==
3320 !! result
3321 <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>
3322
3323 !! end
3324
3325
3326 !! test
3327 BUG 1219 URL next to image (good)
3328 !! input
3329 http://example.com [[Image:foobar.jpg]]
3330 !! result
3331 <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>
3332 </p>
3333 !!end
3334
3335 !! test
3336 BUG 1219 URL next to image (broken)
3337 !! input
3338 http://example.com[[Image:foobar.jpg]]
3339 !! result
3340 <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>
3341 </p>
3342 !!end
3343
3344 !! test
3345 Bug 1186 news: in the middle of text
3346 !! input
3347 http://en.wikinews.org/wiki/Wikinews:Workplace
3348 !! result
3349 <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>
3350 </p>
3351 !!end
3352
3353
3354 !! test
3355 Namespaced link must have a title
3356 !! input
3357 [[Project:]]
3358 !! result
3359 <p>[[Project:]]
3360 </p>
3361 !!end
3362
3363 !! test
3364 Namespaced link must have a title (bad fragment version)
3365 !! input
3366 [[Project:#fragment]]
3367 !! result
3368 <p>[[Project:#fragment]]
3369 </p>
3370 !!end
3371
3372
3373 !! test
3374 div with no attributes
3375 !! input
3376 <div>HTML rocks</div>
3377 !! result
3378 <div>HTML rocks</div>
3379
3380 !! end
3381
3382 !! test
3383 div with double-quoted attribute
3384 !! input
3385 <div id="rock">HTML rocks</div>
3386 !! result
3387 <div id="rock">HTML rocks</div>
3388
3389 !! end
3390
3391 !! test
3392 div with single-quoted attribute
3393 !! input
3394 <div id='rock'>HTML rocks</div>
3395 !! result
3396 <div id="rock">HTML rocks</div>
3397
3398 !! end
3399
3400 !! test
3401 div with unquoted attribute
3402 !! input
3403 <div id=rock>HTML rocks</div>
3404 !! result
3405 <div id="rock">HTML rocks</div>
3406
3407 !! end
3408
3409 !! test
3410 div with illegal double attributes
3411 !! input
3412 <div align="center" align="right">HTML rocks</div>
3413 !! result
3414 <div align="right">HTML rocks</div>
3415
3416 !!end
3417
3418 !! test
3419 HTML multiple attributes correction
3420 !! input
3421 <p class="error" class="awesome">Awesome!</p>
3422 !! result
3423 <p class="awesome">Awesome!</p>
3424
3425 !!end
3426
3427 !! test
3428 Table multiple attributes correction
3429 !! input
3430 {|
3431 !+ class="error" class="awesome"| status
3432 |}
3433 !! result
3434 <table>
3435 <tr>
3436 <th class="awesome"> status
3437 </th></tr></table>
3438
3439 !!end
3440
3441 !! test
3442 DIV IN UPPERCASE
3443 !! input
3444 <DIV ALIGN="center">HTML ROCKS</DIV>
3445 !! result
3446 <div align="center">HTML ROCKS</div>
3447
3448 !!end
3449
3450
3451 !! test
3452 text with amp in the middle of nowhere
3453 !! input
3454 Remember AT&T?
3455 !!result
3456 <p>Remember AT&amp;T?
3457 </p>
3458 !! end
3459
3460 !! test
3461 text with character entity: eacute
3462 !! input
3463 I always thought &eacute; was a cute letter.
3464 !! result
3465 <p>I always thought &eacute; was a cute letter.
3466 </p>
3467 !! end
3468
3469 !! test
3470 text with undefined character entity: xacute
3471 !! input
3472 I always thought &xacute; was a cute letter.
3473 !! result
3474 <p>I always thought &amp;xacute; was a cute letter.
3475 </p>
3476 !! end
3477
3478
3479 ###
3480 ### Media links
3481 ###
3482
3483 !! test
3484 Media link
3485 !! input
3486 [[Media:Foobar.jpg]]
3487 !! result
3488 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3489 </p>
3490 !! end
3491
3492 !! test
3493 Media link with text
3494 !! input
3495 [[Media:Foobar.jpg|A neat file to look at]]
3496 !! result
3497 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3498 </p>
3499 !! end
3500
3501 # FIXME: this is still bad HTML tag nesting
3502 !! test
3503 Media link with nasty text
3504 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3505 !! input
3506 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3507 !! result
3508 <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>
3509
3510 !! end
3511
3512 !! test
3513 Media link to nonexistent file (bug 1702)
3514 !! input
3515 [[Media:No such.jpg]]
3516 !! result
3517 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3518 </p>
3519 !! end
3520
3521 !! test
3522 Image link to nonexistent file (bug 1850 - good)
3523 !! input
3524 [[Image:No such.jpg]]
3525 !! result
3526 <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>
3527 </p>
3528 !! end
3529
3530 !! test
3531 :Image link to nonexistent file (bug 1850 - bad)
3532 !! input
3533 [[:Image:No such.jpg]]
3534 !! result
3535 <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>
3536 </p>
3537 !! end
3538
3539
3540
3541 !! test
3542 Character reference normalization in link text (bug 1938)
3543 !! input
3544 [[Main Page|this&that]]
3545 !! result
3546 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3547 </p>
3548 !!end
3549
3550 !! test
3551 Empty attribute crash test (bug 2067)
3552 !! input
3553 <font color="">foo</font>
3554 !! result
3555 <p><font color="">foo</font>
3556 </p>
3557 !! end
3558
3559 !! test
3560 Empty attribute crash test single-quotes (bug 2067)
3561 !! input
3562 <font color=''>foo</font>
3563 !! result
3564 <p><font color="">foo</font>
3565 </p>
3566 !! end
3567
3568 !! test
3569 Attribute test: equals, then nothing
3570 !! input
3571 <font color=>foo</font>
3572 !! result
3573 <p><font>foo</font>
3574 </p>
3575 !! end
3576
3577 !! test
3578 Attribute test: unquoted value
3579 !! input
3580 <font color=x>foo</font>
3581 !! result
3582 <p><font color="x">foo</font>
3583 </p>
3584 !! end
3585
3586 !! test
3587 Attribute test: unquoted but illegal value (hash)
3588 !! input
3589 <font color=#x>foo</font>
3590 !! result
3591 <p><font color="#x">foo</font>
3592 </p>
3593 !! end
3594
3595 !! test
3596 Attribute test: no value
3597 !! input
3598 <font color>foo</font>
3599 !! result
3600 <p><font color="color">foo</font>
3601 </p>
3602 !! end
3603
3604 !! test
3605 Bug 2095: link with three closing brackets
3606 !! input
3607 [[Main Page]]]
3608 !! result
3609 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3610 </p>
3611 !! end
3612
3613 !! test
3614 Bug 2095: link with pipe and three closing brackets
3615 !! input
3616 [[Main Page|link]]]
3617 !! result
3618 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3619 </p>
3620 !! end
3621
3622 !! test
3623 Bug 2095: link with pipe and three closing brackets, version 2
3624 !! input
3625 [[Main Page|[http://example.com/]]]
3626 !! result
3627 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3628 </p>
3629 !! end
3630
3631
3632 ###
3633 ### Safety
3634 ###
3635
3636 !! article
3637 Template:Dangerous attribute
3638 !! text
3639 " onmouseover="alert(document.cookie)
3640 !! endarticle
3641
3642 !! article
3643 Template:Dangerous style attribute
3644 !! text
3645 border-size: expression(alert(document.cookie))
3646 !! endarticle
3647
3648 !! article
3649 Template:Div style
3650 !! text
3651 <div style="float: right; {{{1}}}">Magic div</div>
3652 !! endarticle
3653
3654 !! test
3655 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3656 !! input
3657 <div title="{{test}}"></div>
3658 !! result
3659 <div title="This is a test template"></div>
3660
3661 !! end
3662
3663 !! test
3664 Bug 2304: HTML attribute safety (dangerous template; 2309)
3665 !! input
3666 <div title="{{dangerous attribute}}"></div>
3667 !! result
3668 <div title=""></div>
3669
3670 !! end
3671
3672 !! test
3673 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3674 !! input
3675 <div style="{{dangerous style attribute}}"></div>
3676 !! result
3677 <div></div>
3678
3679 !! end
3680
3681 !! test
3682 Bug 2304: HTML attribute safety (safe parameter; 2309)
3683 !! input
3684 {{div style|width: 200px}}
3685 !! result
3686 <div style="float: right; width: 200px">Magic div</div>
3687
3688 !! end
3689
3690 !! test
3691 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3692 !! input
3693 {{div style|width: expression(alert(document.cookie))}}
3694 !! result
3695 <div>Magic div</div>
3696
3697 !! end
3698
3699 !! test
3700 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3701 !! input
3702 {{div style|"><script>alert(document.cookie)</script>}}
3703 !! result
3704 <div>Magic div</div>
3705
3706 !! end
3707
3708 !! test
3709 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3710 !! input
3711 {{div style|" ><script>alert(document.cookie)</script>}}
3712 !! result
3713 <div style="float: right;">Magic div</div>
3714
3715 !! end
3716
3717 !! test
3718 Bug 2304: HTML attribute safety (link)
3719 !! input
3720 <div title="[[Main Page]]"></div>
3721 !! result
3722 <div title="&#91;&#91;Main Page]]"></div>
3723
3724 !! end
3725
3726 !! test
3727 Bug 2304: HTML attribute safety (italics)
3728 !! input
3729 <div title="''foobar''"></div>
3730 !! result
3731 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3732
3733 !! end
3734
3735 !! test
3736 Bug 2304: HTML attribute safety (bold)
3737 !! input
3738 <div title="'''foobar'''"></div>
3739 !! result
3740 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3741
3742 !! end
3743
3744
3745 !! test
3746 Bug 2304: HTML attribute safety (ISBN)
3747 !! input
3748 <div title="ISBN 1234567890"></div>
3749 !! result
3750 <div title="&#73;SBN 1234567890"></div>
3751
3752 !! end
3753
3754 !! test
3755 Bug 2304: HTML attribute safety (RFC)
3756 !! input
3757 <div title="RFC 1234"></div>
3758 !! result
3759 <div title="&#82;FC 1234"></div>
3760
3761 !! end
3762
3763 !! test
3764 Bug 2304: HTML attribute safety (PMID)
3765 !! input
3766 <div title="PMID 1234567890"></div>
3767 !! result
3768 <div title="&#80;MID 1234567890"></div>
3769
3770 !! end
3771
3772 !! test
3773 Bug 2304: HTML attribute safety (web link)
3774 !! input
3775 <div title="http://example.com/"></div>
3776 !! result
3777 <div title="http&#58;//example.com/"></div>
3778
3779 !! end
3780
3781 !! test
3782 Bug 2304: HTML attribute safety (named web link)
3783 !! input
3784 <div title="[http://example.com/ link]"></div>
3785 !! result
3786 <div title="&#91;http&#58;//example.com/ link]"></div>
3787
3788 !! end
3789
3790 !! test
3791 Bug 3244: HTML attribute safety (extension; safe)
3792 !! input
3793 <div style="<nowiki>background:blue</nowiki>"></div>
3794 !! result
3795 <div style="background:blue"></div>
3796
3797 !! end
3798
3799 !! test
3800 Bug 3244: HTML attribute safety (extension; unsafe)
3801 !! input
3802 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3803 !! result
3804 <div></div>
3805
3806 !! end
3807
3808 !! test
3809 Math section safety when disabled
3810 !! input
3811 <math><script>alert(document.cookies);</script></math>
3812 !! result
3813 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3814 </p>
3815 !! end
3816
3817 # More MSIE fun discovered by Tom Gilder
3818
3819 !! test
3820 MSIE CSS safety test: spurious slash
3821 !! input
3822 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3823 !! result
3824 <div>evil</div>
3825
3826 !! end
3827
3828 !! test
3829 MSIE CSS safety test: hex code
3830 !! input
3831 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3832 !! result
3833 <div>evil</div>
3834
3835 !! end
3836
3837 !! test
3838 MSIE CSS safety test: comment in url
3839 !! input
3840 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3841 !! result
3842 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3843
3844 !! end
3845
3846 !! test
3847 MSIE CSS safety test: comment in expression
3848 !! input
3849 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3850 !! result
3851 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3852
3853 !! end
3854
3855
3856 !! test
3857 Table attribute legitimate extension
3858 !! input
3859 {|
3860 !+ style="<nowiki>color:blue</nowiki>"| status
3861 |}
3862 !! result
3863 <table>
3864 <tr>
3865 <th style="color:blue"> status
3866 </th></tr></table>
3867
3868 !!end
3869
3870 !! test
3871 Table attribute safety
3872 !! input
3873 {|
3874 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3875 |}
3876 !! result
3877 <table>
3878 <tr>
3879 <th> status
3880 </th></tr></table>
3881
3882 !! end
3883
3884
3885 !! article
3886 Template:Identity
3887 !! text
3888 {{{1}}}
3889 !! endarticle
3890
3891 !! test
3892 Expansion of multi-line templates in attribute values (bug 6255)
3893 !! input
3894 <div style="background: {{identity|#00FF00}}">-</div>
3895 !! result
3896 <div style="background: #00FF00">-</div>
3897
3898 !! end
3899
3900
3901 !! test
3902 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3903 !! input
3904 <div style="background:
3905 #00FF00">-</div>
3906 !! result
3907 <div style="background: #00FF00">-</div>
3908
3909 !! end
3910
3911 !! test
3912 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3913 !! input
3914 <div style="background: &#10;#00FF00">-</div>
3915 !! result
3916 <div style="background: &#10;#00FF00">-</div>
3917
3918 !! end
3919
3920 ###
3921 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3922 ###
3923 !! test
3924 Parser hook: empty input
3925 !! input
3926 <tag></tag>
3927 !! result
3928 <pre>
3929 string(0) ""
3930 array(0) {
3931 }
3932 </pre>
3933
3934 !! end
3935
3936 !! test
3937 Parser hook: empty input using terminated empty elements
3938 !! input
3939 <tag/>
3940 !! result
3941 <pre>
3942 NULL
3943 array(0) {
3944 }
3945 </pre>
3946
3947 !! end
3948
3949 !! test
3950 Parser hook: empty input using terminated empty elements (space before)
3951 !! input
3952 <tag />
3953 !! result
3954 <pre>
3955 NULL
3956 array(0) {
3957 }
3958 </pre>
3959
3960 !! end
3961
3962 !! test
3963 Parser hook: basic input
3964 !! input
3965 <tag>input</tag>
3966 !! result
3967 <pre>
3968 string(5) "input"
3969 array(0) {
3970 }
3971 </pre>
3972
3973 !! end
3974
3975
3976 !! test
3977 Parser hook: case insensetive
3978 !! input
3979 <TAG>input</TAG>
3980 !! result
3981 <pre>
3982 string(5) "input"
3983 array(0) {
3984 }
3985 </pre>
3986
3987 !! end
3988
3989
3990 !! test
3991 Parser hook: case insensetive, redux
3992 !! input
3993 <TaG>input</TAg>
3994 !! result
3995 <pre>
3996 string(5) "input"
3997 array(0) {
3998 }
3999 </pre>
4000
4001 !! end
4002
4003 !! test
4004 Parser hook: nested tags
4005 !! options
4006 noxml
4007 !! input
4008 <tag><tag></tag></tag>
4009 !! result
4010 <pre>
4011 string(5) "<tag>"
4012 array(0) {
4013 }
4014 </pre>&lt;/tag&gt;
4015
4016 !! end
4017
4018 !! test
4019 Parser hook: basic arguments
4020 !! input
4021 <tag width=200 height = "100" depth = '50' square></tag>
4022 !! result
4023 <pre>
4024 string(0) ""
4025 array(4) {
4026 ["width"]=>
4027 string(3) "200"
4028 ["height"]=>
4029 string(3) "100"
4030 ["depth"]=>
4031 string(2) "50"
4032 ["square"]=>
4033 string(6) "square"
4034 }
4035 </pre>
4036
4037 !! end
4038
4039 !! test
4040 Parser hook: argument containing a forward slash (bug 5344)
4041 !! input
4042 <tag filename='/tmp/bla'></tag>
4043 !! result
4044 <pre>
4045 string(0) ""
4046 array(1) {
4047 ["filename"]=>
4048 string(8) "/tmp/bla"
4049 }
4050 </pre>
4051
4052 !! end
4053
4054 !! test
4055 Parser hook: empty input using terminated empty elements (bug 2374)
4056 !! input
4057 <tag foo=bar/>text
4058 !! result
4059 <pre>
4060 NULL
4061 array(1) {
4062 ["foo"]=>
4063 string(3) "bar"
4064 }
4065 </pre>text
4066
4067 !! end
4068
4069 # </tag> should be output literally since there is no matching tag that begins it
4070 !! test
4071 Parser hook: basic arguments using terminated empty elements (bug 2374)
4072 !! input
4073 <tag width=200 height = "100" depth = '50' square/>
4074 other stuff
4075 </tag>
4076 !! result
4077 <pre>
4078 NULL
4079 array(4) {
4080 ["width"]=>
4081 string(3) "200"
4082 ["height"]=>
4083 string(3) "100"
4084 ["depth"]=>
4085 string(2) "50"
4086 ["square"]=>
4087 string(6) "square"
4088 }
4089 </pre>
4090 <p>other stuff
4091 &lt;/tag&gt;
4092 </p>
4093 !! end
4094
4095 ###
4096 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4097 ###
4098
4099 !! test
4100 Parser hook: static parser hook not inside a comment
4101 !! input
4102 <statictag>hello, world</statictag>
4103 <statictag action=flush/>
4104 !! result
4105 <p>hello, world
4106 </p>
4107 !! end
4108
4109
4110 !! test
4111 Parser hook: static parser hook inside a comment
4112 !! input
4113 <!-- <statictag>hello, world</statictag> -->
4114 <statictag action=flush/>
4115 !! result
4116 <p><br />
4117 </p>
4118 !! end
4119
4120 # Nested template calls; this case was broken by Parser.php rev 1.506,
4121 # since reverted.
4122
4123 !! article
4124 Template:One-parameter
4125 !! text
4126 (My parameter is: {{{1}}})
4127 !! endarticle
4128
4129 !! article
4130 Template:Map-one-parameter
4131 !! text
4132 {{{{{1}}}|{{{2}}}}}
4133 !! endarticle
4134
4135 !! test
4136 Nested template calls
4137 !! input
4138 {{Map-one-parameter|One-parameter|param}}
4139 !! result
4140 <p>(My parameter is: param)
4141 </p>
4142 !! end
4143
4144
4145 ###
4146 ### Sanitizer
4147 ###
4148 !! test
4149 Sanitizer: Closing of open tags
4150 !! input
4151 <s></s><table></table>
4152 !! result
4153 <s></s><table></table>
4154
4155 !! end
4156
4157 !! test
4158 Sanitizer: Closing of open but not closed tags
4159 !! input
4160 <s>foo
4161 !! result
4162 <p><s>foo</s>
4163 </p>
4164 !! end
4165
4166 !! test
4167 Sanitizer: Closing of closed but not open tags
4168 !! input
4169 </s>
4170 !! result
4171 <p>&lt;/s&gt;
4172 </p>
4173 !! end
4174
4175 !! test
4176 Sanitizer: Closing of closed but not open table tags
4177 !! input
4178 Table not started</td></tr></table>
4179 !! result
4180 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4181 </p>
4182 !! end
4183
4184 !! test
4185 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4186 !! input
4187 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4188 !! result
4189 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4190 </p>
4191 !! end
4192
4193 !! test
4194 Sanitizer: Validating the contents of the id attribute (bug 4515)
4195 !! options
4196 disabled
4197 !! input
4198 <br id=9 />
4199 !! result
4200 Something, but defenetly not <br id="9" />...
4201 !! end
4202
4203 !! test
4204 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4205 !! options
4206 disabled
4207 !! input
4208 <br id="foo" /><br id="foo" />
4209 !! result
4210 Something need to be done. foo-2 ?
4211 !! end
4212
4213 !! test
4214 Language converter: output gets cut off unexpectedly (bug 5757)
4215 !! options
4216 language=zh
4217 !! input
4218 this bit is safe: }-
4219
4220 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4221
4222 then we get cut off here: }-
4223
4224 all additional text is vanished
4225 !! result
4226 <p>this bit is safe: }-
4227 </p><p>but if we add a conversion instance: xxx
4228 </p><p>then we get cut off here: }-
4229 </p><p>all additional text is vanished
4230 </p>
4231 !! end
4232
4233 !! test
4234 Self closed html pairs (bug 5487)
4235 !! options
4236 !! input
4237 <center><font id="bug" />Centered text</center>
4238 <div><font id="bug2" />In div text</div>
4239 !! result
4240 <center>&lt;font id="bug" /&gt;Centered text</center>
4241 <div>&lt;font id="bug2" /&gt;In div text</div>
4242
4243 !! end
4244
4245 #
4246 #
4247 #
4248
4249 !! test
4250 HTML bullet list, closed tags (bug 5497)
4251 !! input
4252 <ul>
4253 <li>One</li>
4254 <li>Two</li>
4255 </ul>
4256 !! result
4257 <ul>
4258 <li>One</li>
4259 <li>Two</li>
4260 </ul>
4261
4262 !! end
4263
4264 !! test
4265 TODO: HTML bullet list, unclosed tags (bug 5497)
4266 !! input
4267 <ul>
4268 <li>One
4269 <li>Two
4270 </ul>
4271 !! result
4272 <ul>
4273 <li>One
4274 </li><li>Two
4275 </li></ul>
4276
4277 !! end
4278
4279 !! test
4280 HTML ordered list, closed tags (bug 5497)
4281 !! input
4282 <ol>
4283 <li>One</li>
4284 <li>Two</li>
4285 </ol>
4286 !! result
4287 <ol>
4288 <li>One</li>
4289 <li>Two</li>
4290 </ol>
4291
4292 !! end
4293
4294 !! test
4295 TODO: HTML ordered list, unclosed tags (bug 5497)
4296 !! input
4297 <ol>
4298 <li>One
4299 <li>Two
4300 </ol>
4301 !! result
4302 <ol>
4303 <li>One
4304 </li><li>Two
4305 </li></ol>
4306
4307 !! end
4308
4309 !! test
4310 HTML nested bullet list, closed tags (bug 5497)
4311 !! input
4312 <ul>
4313 <li>One</li>
4314 <li>Two:
4315 <ul>
4316 <li>Sub-one</li>
4317 <li>Sub-two</li>
4318 </ul>
4319 </li>
4320 </ul>
4321 !! result
4322 <ul>
4323 <li>One</li>
4324 <li>Two:
4325 <ul>
4326 <li>Sub-one</li>
4327 <li>Sub-two</li>
4328 </ul>
4329 </li>
4330 </ul>
4331
4332 !! end
4333
4334 !! test
4335 TODO: HTML nested bullet list, open tags (bug 5497)
4336 !! input
4337 <ul>
4338 <li>One
4339 <li>Two:
4340 <ul>
4341 <li>Sub-one
4342 <li>Sub-two
4343 </ul>
4344 </ul>
4345 !! result
4346 <ul>
4347 <li>One
4348 </li><li>Two:
4349 <ul>
4350 <li>Sub-one
4351 </li><li>Sub-two
4352 </li></ul>
4353 </li></ul>
4354
4355 !! end
4356
4357 !! test
4358 HTML nested ordered list, closed tags (bug 5497)
4359 !! input
4360 <ol>
4361 <li>One</li>
4362 <li>Two:
4363 <ol>
4364 <li>Sub-one</li>
4365 <li>Sub-two</li>
4366 </ol>
4367 </li>
4368 </ol>
4369 !! result
4370 <ol>
4371 <li>One</li>
4372 <li>Two:
4373 <ol>
4374 <li>Sub-one</li>
4375 <li>Sub-two</li>
4376 </ol>
4377 </li>
4378 </ol>
4379
4380 !! end
4381
4382 !! test
4383 TODO: HTML nested ordered list, open tags (bug 5497)
4384 !! input
4385 <ol>
4386 <li>One
4387 <li>Two:
4388 <ol>
4389 <li>Sub-one
4390 <li>Sub-two
4391 </ol>
4392 </ol>
4393 !! result
4394 <ol>
4395 <li>One
4396 </li><li>Two:
4397 <ol>
4398 <li>Sub-one
4399 </li><li>Sub-two
4400 </li></ol>
4401 </li></ol>
4402
4403 !! end
4404
4405 !! test
4406 HTML ordered list item with parameters oddity
4407 !! input
4408 <ol><li id="fragment">One</li></ol>
4409 !! result
4410 <ol><li id="fragment">One</li></ol>
4411
4412 !! end
4413
4414 !!test
4415 bug 5918: autonumbering
4416 !! input
4417 [http://first/] [http://second] [ftp://ftp]
4418
4419 ftp://inlineftp
4420
4421 [mailto:enclosed@mail.tld With target]
4422
4423 [mailto:enclosed@mail.tld]
4424
4425 mailto:inline@mail.tld
4426 !! result
4427 <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>
4428 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4429 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4430 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4431 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4432 </p>
4433 !! end
4434
4435
4436 #
4437 # Security and HTML correctness
4438 # From Nick Jenkins' fuzz testing
4439 #
4440
4441 !! test
4442 Fuzz testing: Parser13
4443 !! input
4444 {|
4445 | http://a|
4446 !! result
4447 <table>
4448 <tr>
4449 <td>
4450 </td>
4451 </tr>
4452 </table>
4453
4454 !! end
4455
4456 !! test
4457 Fuzz testing: Parser14
4458 !! input
4459 == onmouseover= ==
4460 http://__TOC__
4461 !! result
4462 <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>
4463 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4464 <ul>
4465 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4466 </ul>
4467 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4468
4469 !! end
4470
4471 !! test
4472 Fuzz testing: Parser14-table
4473 !! input
4474 ==a==
4475 {| STYLE=__TOC__
4476 !! result
4477 <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>
4478 <table style="&#95;_TOC&#95;_">
4479 <tr><td></td></tr>
4480 </table>
4481
4482 !! end
4483
4484 # Known to produce bogus xml (extra </td>)
4485 !! test
4486 Fuzz testing: Parser16
4487 !! options
4488 noxml
4489 !! input
4490 {|
4491 !https://||||||
4492 !! result
4493 <table>
4494 <tr>
4495 <th>https://</th><th></th><th></th><th>
4496 </td>
4497 </tr>
4498 </table>
4499
4500 !! end
4501
4502 !! test
4503 Fuzz testing: Parser21
4504 !! input
4505 {|
4506 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4507 |
4508 !! result
4509 <table>
4510 <tr>
4511 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4512 </th><td>
4513 </td>
4514 </tr>
4515 </table>
4516
4517 !! end
4518
4519 !! test
4520 Fuzz testing: Parser22
4521 !! input
4522 http://===r:::https://b
4523
4524 {|
4525 !!result
4526 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4527 </p>
4528 <table>
4529 <tr><td></td></tr>
4530 </table>
4531
4532 !! end
4533
4534 # Known to produce bad XML for now
4535 !! test
4536 Fuzz testing: Parser24
4537 !! options
4538 noxml
4539 !! input
4540 {|
4541 {{{|
4542 <u CLASS=
4543 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4544 <br style="onmouseover='alert(document.cookie);' " />
4545
4546 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4547 |
4548 !! result
4549 <table>
4550
4551 <u class="&#124;">} &gt;
4552 <br style="onmouseover='alert(document.cookie);'" />
4553
4554 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4555 <tr>
4556 <td></u>
4557 </td>
4558 </tr>
4559 </table>
4560
4561 !! end
4562
4563 # Known to produce bad XML for now
4564 !!test
4565 Fuzz testing: Parser25 (bug 6055)
4566 !! options
4567 noxml
4568 !! input
4569 {{{
4570 |
4571 <LI CLASS=||
4572 >
4573 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4574 !! result
4575 <li class="&#124;&#124;">
4576 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4577
4578 !! end
4579
4580 !!test
4581 Fuzz testing: URL adjacent extension (with space, clean)
4582 !! options
4583 !! input
4584 http://example.com <nowiki>junk</nowiki>
4585 !! result
4586 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
4587 </p>
4588 !!end
4589
4590 !!test
4591 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4592 !! options
4593 !! input
4594 http://example.com<nowiki>junk</nowiki>
4595 !! result
4596 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
4597 </p>
4598 !!end
4599
4600 !!test
4601 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4602 !! options
4603 !! input
4604 http://example.com<pre>junk</pre>
4605 !! result
4606 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4607
4608 !!end
4609
4610 !!test
4611 Fuzz testing: image with bogus manual thumbnail
4612 !!input
4613 [[Image:foobar.jpg|thumbnail= ]]
4614 !!result
4615 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="180" height="-1" longdesc="/wiki/Image:Foobar.jpg" /></a> <div class="thumbcaption"><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div></div></div></div>
4616
4617 !!end
4618
4619 !! test
4620 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
4621 !! input
4622 <pre dir="&#10;"></pre>
4623 !! result
4624 <pre dir="&#10;"></pre>
4625
4626 !! end
4627
4628 !! test
4629 TODO: Parsing optional HTML elements (Bug 6171)
4630 !! options
4631 !! input
4632 <table>
4633 <tr>
4634 <td> Some tabular data</td>
4635 <td> More tabular data ...
4636 <td> And yet som tabular data</td>
4637 </tr>
4638 </table>
4639 !! result
4640 <table>
4641 <tr>
4642 <td> Some tabular data</td>
4643 <td> More tabular data ...
4644 </td><td> And yet som tabular data</td>
4645 </tr>
4646 </table>
4647
4648 !! end
4649
4650 !! test
4651 Correct handling of <td>, <tr> (Bug 6171)
4652 !! options
4653 !! input
4654 <table>
4655 <tr>
4656 <td> Some tabular data</td>
4657 <td> More tabular data ...</td>
4658 <td> And yet som tabular data</td>
4659 </tr>
4660 </table>
4661 !! result
4662 <table>
4663 <tr>
4664 <td> Some tabular data</td>
4665 <td> More tabular data ...</td>
4666 <td> And yet som tabular data</td>
4667 </tr>
4668 </table>
4669
4670 !! end
4671
4672
4673 !! test
4674 Parsing crashing regression (fr:JavaScript)
4675 !! input
4676 </body></x>
4677 !! result
4678 <p>&lt;/body&gt;&lt;/x&gt;
4679 </p>
4680 !! end
4681
4682 !! test
4683 Inline wiki vs wiki block nesting
4684 !! input
4685 '''Bold paragraph
4686
4687 New wiki paragraph
4688 !! result
4689 <p><b>Bold paragraph</b>
4690 </p><p>New wiki paragraph
4691 </p>
4692 !! end
4693
4694 !! test
4695 TODO: Inline HTML vs wiki block nesting
4696 !! input
4697 <b>Bold paragraph
4698
4699 New wiki paragraph
4700 !! result
4701 <p><b>Bold paragraph</b>
4702 </p><p>New wiki paragraph
4703 </p>
4704 !! end
4705
4706
4707 !!test
4708 TODO: Mixing markup for italics and bold
4709 !! options
4710 !! input
4711 '''bold''''''bold''bolditalics'''''
4712 !! result
4713 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4714 </p>
4715 !! end
4716
4717
4718 !! article
4719 Xyzzyx
4720 !! text
4721 Article for special page transclusion test
4722 !! endarticle
4723
4724 !! test
4725 Special page transclusion
4726 !! options
4727 !! input
4728 {{Special:Prefixindex/Xyzzyx}}
4729 !! result
4730 <p><br />
4731 </p>
4732 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4733
4734 !! end
4735
4736 !! test
4737 Special page transclusion twice (bug 5021)
4738 !! options
4739 !! input
4740 {{Special:Prefixindex/Xyzzyx}}
4741 {{Special:Prefixindex/Xyzzyx}}
4742 !! result
4743 <p><br />
4744 </p>
4745 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4746 <p><br />
4747 </p>
4748 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4749
4750 !! end
4751
4752 !! test
4753 Invalid header with following text
4754 !! input
4755 = x = y
4756 !! result
4757 <p>= x = y
4758 </p>
4759 !! end
4760
4761
4762 !! test
4763 Section extraction test (section 0)
4764 !! options
4765 section=0
4766 !! input
4767 start
4768 ==a==
4769 ===aa===
4770 ====aaa====
4771 ==b==
4772 ===ba===
4773 ===bb===
4774 ====bba====
4775 ===bc===
4776 ==c==
4777 ===ca===
4778 !! result
4779 start
4780 !! end
4781
4782 !! test
4783 Section extraction test (section 1)
4784 !! options
4785 section=1
4786 !! input
4787 start
4788 ==a==
4789 ===aa===
4790 ====aaa====
4791 ==b==
4792 ===ba===
4793 ===bb===
4794 ====bba====
4795 ===bc===
4796 ==c==
4797 ===ca===
4798 !! result
4799 ==a==
4800 ===aa===
4801 ====aaa====
4802 !! end
4803
4804 !! test
4805 Section extraction test (section 2)
4806 !! options
4807 section=2
4808 !! input
4809 start
4810 ==a==
4811 ===aa===
4812 ====aaa====
4813 ==b==
4814 ===ba===
4815 ===bb===
4816 ====bba====
4817 ===bc===
4818 ==c==
4819 ===ca===
4820 !! result
4821 ===aa===
4822 ====aaa====
4823 !! end
4824
4825 !! test
4826 Section extraction test (section 3)
4827 !! options
4828 section=3
4829 !! input
4830 start
4831 ==a==
4832 ===aa===
4833 ====aaa====
4834 ==b==
4835 ===ba===
4836 ===bb===
4837 ====bba====
4838 ===bc===
4839 ==c==
4840 ===ca===
4841 !! result
4842 ====aaa====
4843 !! end
4844
4845 !! test
4846 Section extraction test (section 4)
4847 !! options
4848 section=4
4849 !! input
4850 start
4851 ==a==
4852 ===aa===
4853 ====aaa====
4854 ==b==
4855 ===ba===
4856 ===bb===
4857 ====bba====
4858 ===bc===
4859 ==c==
4860 ===ca===
4861 !! result
4862 ==b==
4863 ===ba===
4864 ===bb===
4865 ====bba====
4866 ===bc===
4867 !! end
4868
4869 !! test
4870 Section extraction test (section 5)
4871 !! options
4872 section=5
4873 !! input
4874 start
4875 ==a==
4876 ===aa===
4877 ====aaa====
4878 ==b==
4879 ===ba===
4880 ===bb===
4881 ====bba====
4882 ===bc===
4883 ==c==
4884 ===ca===
4885 !! result
4886 ===ba===
4887 !! end
4888
4889 !! test
4890 Section extraction test (section 6)
4891 !! options
4892 section=6
4893 !! input
4894 start
4895 ==a==
4896 ===aa===
4897 ====aaa====
4898 ==b==
4899 ===ba===
4900 ===bb===
4901 ====bba====
4902 ===bc===
4903 ==c==
4904 ===ca===
4905 !! result
4906 ===bb===
4907 ====bba====
4908 !! end
4909
4910 !! test
4911 Section extraction test (section 7)
4912 !! options
4913 section=7
4914 !! input
4915 start
4916 ==a==
4917 ===aa===
4918 ====aaa====
4919 ==b==
4920 ===ba===
4921 ===bb===
4922 ====bba====
4923 ===bc===
4924 ==c==
4925 ===ca===
4926 !! result
4927 ====bba====
4928 !! end
4929
4930 !! test
4931 Section extraction test (section 8)
4932 !! options
4933 section=8
4934 !! input
4935 start
4936 ==a==
4937 ===aa===
4938 ====aaa====
4939 ==b==
4940 ===ba===
4941 ===bb===
4942 ====bba====
4943 ===bc===
4944 ==c==
4945 ===ca===
4946 !! result
4947 ===bc===
4948 !! end
4949
4950 !! test
4951 Section extraction test (section 9)
4952 !! options
4953 section=9
4954 !! input
4955 start
4956 ==a==
4957 ===aa===
4958 ====aaa====
4959 ==b==
4960 ===ba===
4961 ===bb===
4962 ====bba====
4963 ===bc===
4964 ==c==
4965 ===ca===
4966 !! result
4967 ==c==
4968 ===ca===
4969 !! end
4970
4971 !! test
4972 Section extraction test (section 10)
4973 !! options
4974 section=10
4975 !! input
4976 start
4977 ==a==
4978 ===aa===
4979 ====aaa====
4980 ==b==
4981 ===ba===
4982 ===bb===
4983 ====bba====
4984 ===bc===
4985 ==c==
4986 ===ca===
4987 !! result
4988 ===ca===
4989 !! end
4990
4991 !! test
4992 Section extraction test (nonexistent section 11)
4993 !! options
4994 section=11
4995 !! input
4996 start
4997 ==a==
4998 ===aa===
4999 ====aaa====
5000 ==b==
5001 ===ba===
5002 ===bb===
5003 ====bba====
5004 ===bc===
5005 ==c==
5006 ===ca===
5007 !! result
5008 !! end
5009
5010 !! test
5011 Section extraction test with bogus heading (section 1)
5012 !! options
5013 section=1
5014 !! input
5015 ==a==
5016 ==bogus== not a legal section
5017 ==b==
5018 !! result
5019 ==a==
5020 ==bogus== not a legal section
5021 !! end
5022
5023 !! test
5024 Section extraction test with bogus heading (section 2)
5025 !! options
5026 section=2
5027 !! input
5028 ==a==
5029 ==bogus== not a legal section
5030 ==b==
5031 !! result
5032 ==b==
5033 !! end
5034
5035 !! test
5036 Section extraction test with comment after heading (section 1)
5037 !! options
5038 section=1
5039 !! input
5040 ==a==
5041 ==legal== <!-- a legal section -->
5042 ==b==
5043 !! result
5044 ==a==
5045 !! end
5046
5047 !! test
5048 Section extraction test with comment after heading (section 2)
5049 !! options
5050 section=2
5051 !! input
5052 ==a==
5053 ==legal== <!-- a legal section -->
5054 ==b==
5055 !! result
5056 ==legal== <!-- a legal section -->
5057 !! end
5058
5059 !! test
5060 Section extraction test with bogus <nowiki> heading (section 1)
5061 !! options
5062 section=1
5063 !! input
5064 ==a==
5065 ==bogus== <nowiki>not a legal section</nowiki>
5066 ==b==
5067 !! result
5068 ==a==
5069 ==bogus== <nowiki>not a legal section</nowiki>
5070 !! end
5071
5072 !! test
5073 Section extraction test with bogus <nowiki> heading (section 2)
5074 !! options
5075 section=2
5076 !! input
5077 ==a==
5078 ==bogus== <nowiki>not a legal section</nowiki>
5079 ==b==
5080 !! result
5081 ==b==
5082 !! end
5083
5084
5085 !! test
5086 Section extraction prefixed by comment (section 1) (bug 2587)
5087 !! options
5088 section=1
5089 !! input
5090 <!-- -->==sec1==
5091 ==sec2==
5092 !!result
5093 <!-- -->==sec1==
5094 !!end
5095
5096 !! test
5097 Section extraction prefixed by comment (section 2) (bug 2587)
5098 !! options
5099 section=2
5100 !! input
5101 <!-- -->==sec1==
5102 ==sec2==
5103 !!result
5104 ==sec2==
5105 !!end
5106
5107
5108 !! test
5109 Section extraction, mixed wiki and html (section 1) (bug 2607)
5110 !! options
5111 section=1
5112 !! input
5113 <h2>1</h2>
5114 one
5115 ==2==
5116 two
5117 ==3==
5118 three
5119 !! result
5120 <h2>1</h2>
5121 one
5122 !! end
5123
5124 !! test
5125 Section extraction, mixed wiki and html (section 2) (bug 2607)
5126 !! options
5127 section=2
5128 !! input
5129 <h2>1</h2>
5130 one
5131 ==2==
5132 two
5133 ==3==
5134 three
5135 !! result
5136 ==2==
5137 two
5138 !! end
5139
5140
5141 !! test
5142 Section extraction, heading surrounded by <noinclude> (bug 3342)
5143 !! options
5144 section=1
5145 !! input
5146 <noinclude>==a==</noinclude>
5147 text
5148 !! result
5149 <noinclude>==a==</noinclude>
5150 text
5151 !!end
5152
5153
5154 !! test
5155 Section extraction, HTML heading subsections (bug 5272)
5156 !! options
5157 section=1
5158 !! input
5159 <h2>a</h2>
5160 <h3>aa</h3>
5161 <h2>b</h2>
5162 !! result
5163 <h2>a</h2>
5164 <h3>aa</h3>
5165 !! end
5166
5167 !! test
5168 Section extraction, HTML headings should be ignored in extensions (bug 3476)
5169 !! options
5170 section=2
5171 !! input
5172 <h2>a</h2>
5173 <tag>
5174 <h2>not b</h2>
5175 </tag>
5176 <h2>b</h2>
5177 !! result
5178 <h2>b</h2>
5179 !! end
5180
5181 !! test
5182 Section replacement test (section 0)
5183 !! options
5184 replace=0,"xxx"
5185 !! input
5186 start
5187 ==a==
5188 ===aa===
5189 ====aaa====
5190 ==b==
5191 ===ba===
5192 ===bb===
5193 ====bba====
5194 ===bc===
5195 ==c==
5196 ===ca===
5197 !! result
5198 xxx
5199
5200 ==a==
5201 ===aa===
5202 ====aaa====
5203 ==b==
5204 ===ba===
5205 ===bb===
5206 ====bba====
5207 ===bc===
5208 ==c==
5209 ===ca===
5210 !! end
5211
5212 !! test
5213 Section replacement test (section 1)
5214 !! options
5215 replace=1,"xxx"
5216 !! input
5217 start
5218 ==a==
5219 ===aa===
5220 ====aaa====
5221 ==b==
5222 ===ba===
5223 ===bb===
5224 ====bba====
5225 ===bc===
5226 ==c==
5227 ===ca===
5228 !! result
5229 start
5230 xxx
5231
5232 ==b==
5233 ===ba===
5234 ===bb===
5235 ====bba====
5236 ===bc===
5237 ==c==
5238 ===ca===
5239 !! end
5240
5241 !! test
5242 Section replacement test (section 2)
5243 !! options
5244 replace=2,"xxx"
5245 !! input
5246 start
5247 ==a==
5248 ===aa===
5249 ====aaa====
5250 ==b==
5251 ===ba===
5252 ===bb===
5253 ====bba====
5254 ===bc===
5255 ==c==
5256 ===ca===
5257 !! result
5258 start
5259 ==a==
5260 xxx
5261
5262 ==b==
5263 ===ba===
5264 ===bb===
5265 ====bba====
5266 ===bc===
5267 ==c==
5268 ===ca===
5269 !! end
5270
5271 !! test
5272 Section replacement test (section 3)
5273 !! options
5274 replace=3,"xxx"
5275 !! input
5276 start
5277 ==a==
5278 ===aa===
5279 ====aaa====
5280 ==b==
5281 ===ba===
5282 ===bb===
5283 ====bba====
5284 ===bc===
5285 ==c==
5286 ===ca===
5287 !! result
5288 start
5289 ==a==
5290 ===aa===
5291 xxx
5292
5293 ==b==
5294 ===ba===
5295 ===bb===
5296 ====bba====
5297 ===bc===
5298 ==c==
5299 ===ca===
5300 !! end
5301
5302 !! test
5303 Section replacement test (section 4)
5304 !! options
5305 replace=4,"xxx"
5306 !! input
5307 start
5308 ==a==
5309 ===aa===
5310 ====aaa====
5311 ==b==
5312 ===ba===
5313 ===bb===
5314 ====bba====
5315 ===bc===
5316 ==c==
5317 ===ca===
5318 !! result
5319 start
5320 ==a==
5321 ===aa===
5322 ====aaa====
5323 xxx
5324
5325 ==c==
5326 ===ca===
5327 !! end
5328
5329 !! test
5330 Section replacement test (section 5)
5331 !! options
5332 replace=5,"xxx"
5333 !! input
5334 start
5335 ==a==
5336 ===aa===
5337 ====aaa====
5338 ==b==
5339 ===ba===
5340 ===bb===
5341 ====bba====
5342 ===bc===
5343 ==c==
5344 ===ca===
5345 !! result
5346 start
5347 ==a==
5348 ===aa===
5349 ====aaa====
5350 ==b==
5351 xxx
5352
5353 ===bb===
5354 ====bba====
5355 ===bc===
5356 ==c==
5357 ===ca===
5358 !! end
5359
5360 !! test
5361 Section replacement test (section 6)
5362 !! options
5363 replace=6,"xxx"
5364 !! input
5365 start
5366 ==a==
5367 ===aa===
5368 ====aaa====
5369 ==b==
5370 ===ba===
5371 ===bb===
5372 ====bba====
5373 ===bc===
5374 ==c==
5375 ===ca===
5376 !! result
5377 start
5378 ==a==
5379 ===aa===
5380 ====aaa====
5381 ==b==
5382 ===ba===
5383 xxx
5384
5385 ===bc===
5386 ==c==
5387 ===ca===
5388 !! end
5389
5390 !! test
5391 Section replacement test (section 7)
5392 !! options
5393 replace=7,"xxx"
5394 !! input
5395 start
5396 ==a==
5397 ===aa===
5398 ====aaa====
5399 ==b==
5400 ===ba===
5401 ===bb===
5402 ====bba====
5403 ===bc===
5404 ==c==
5405 ===ca===
5406 !! result
5407 start
5408 ==a==
5409 ===aa===
5410 ====aaa====
5411 ==b==
5412 ===ba===
5413 ===bb===
5414 xxx
5415
5416 ===bc===
5417 ==c==
5418 ===ca===
5419 !! end
5420
5421 !! test
5422 Section replacement test (section 8)
5423 !! options
5424 replace=8,"xxx"
5425 !! input
5426 start
5427 ==a==
5428 ===aa===
5429 ====aaa====
5430 ==b==
5431 ===ba===
5432 ===bb===
5433 ====bba====
5434 ===bc===
5435 ==c==
5436 ===ca===
5437 !! result
5438 start
5439 ==a==
5440 ===aa===
5441 ====aaa====
5442 ==b==
5443 ===ba===
5444 ===bb===
5445 ====bba====
5446 xxx
5447
5448 ==c==
5449 ===ca===
5450 !!end
5451
5452 !! test
5453 Section replacement test (section 9)
5454 !! options
5455 replace=9,"xxx"
5456 !! input
5457 start
5458 ==a==
5459 ===aa===
5460 ====aaa====
5461 ==b==
5462 ===ba===
5463 ===bb===
5464 ====bba====
5465 ===bc===
5466 ==c==
5467 ===ca===
5468 !! result
5469 start
5470 ==a==
5471 ===aa===
5472 ====aaa====
5473 ==b==
5474 ===ba===
5475 ===bb===
5476 ====bba====
5477 ===bc===
5478 xxx
5479 !! end
5480
5481 !! test
5482 Section replacement test (section 10)
5483 !! options
5484 replace=10,"xxx"
5485 !! input
5486 start
5487 ==a==
5488 ===aa===
5489 ====aaa====
5490 ==b==
5491 ===ba===
5492 ===bb===
5493 ====bba====
5494 ===bc===
5495 ==c==
5496 ===ca===
5497 !! result
5498 start
5499 ==a==
5500 ===aa===
5501 ====aaa====
5502 ==b==
5503 ===ba===
5504 ===bb===
5505 ====bba====
5506 ===bc===
5507 ==c==
5508 xxx
5509 !! end
5510
5511
5512 !! test
5513 Section extraction, HTML headings not at line boundaries (section 0)
5514 !! options
5515 section=0
5516 !! input
5517 <h2>Evil</h2><i>blah blah blah</i>
5518
5519 evil blah
5520
5521 <h2>Nice</h2>
5522
5523 nice blah
5524
5525 <i>extra evil</i><h2>Extra nasty</h2>
5526
5527 extra nasty
5528 !! result
5529 !! end
5530
5531 !! test
5532 Section extraction, HTML headings not at line boundaries (section 1)
5533 !! options
5534 section=1
5535 !! input
5536 <h2>Evil</h2><i>blah blah blah</i>
5537
5538 evil blah
5539
5540 <h2>Nice</h2>
5541
5542 nice blah
5543
5544 <i>extra evil</i><h2>Extra nasty</h2>
5545
5546 extra nasty
5547 !! result
5548 <h2>Evil</h2><i>blah blah blah</i>
5549
5550 evil blah
5551 !! end
5552
5553 !! test
5554 Section extraction, HTML headings not at line boundaries (section 2)
5555 !! options
5556 section=2
5557 !! input
5558 <h2>Evil</h2><i>blah blah blah</i>
5559
5560 evil blah
5561
5562 <h2>Nice</h2>
5563
5564 nice blah
5565
5566 <i>extra evil</i><h2>Extra nasty</h2>
5567
5568 extra nasty
5569 !! result
5570 <h2>Nice</h2>
5571
5572 nice blah
5573
5574 <i>extra evil</i>
5575 !! end
5576
5577 !! test
5578 Section extraction, HTML headings not at line boundaries (section 3)
5579 !! options
5580 section=3
5581 !! input
5582 <h2>Evil</h2><i>blah blah blah</i>
5583
5584 evil blah
5585
5586 <h2>Nice</h2>
5587
5588 nice blah
5589
5590 <i>extra evil</i><h2>Extra nasty</h2>
5591
5592 extra nasty
5593 !! result
5594 <h2>Extra nasty</h2>
5595
5596 extra nasty
5597 !! end
5598
5599
5600 !! test
5601 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5602 !! options
5603 section=1
5604 !! input
5605 ==a==
5606 a
5607 !! result
5608 ==a==
5609 a
5610 !! end
5611
5612 !! test
5613 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5614 !! options
5615 section=1
5616 !! input
5617 ==a==
5618 a
5619 !! result
5620 ==a==
5621 a
5622 !! end
5623
5624 !! test
5625 Handling of &#x0A; in URLs
5626 !! input
5627 **irc://&#x0A;a
5628 !! result
5629 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
5630 </li></ul>
5631 </li></ul>
5632
5633 !!end
5634
5635 !! test
5636 TODO: 5 quotes, code coverage +1 line
5637 !! input
5638 '''''
5639 !! result
5640 !! end
5641
5642 !! test
5643 Special:Search page linking.
5644 !! input
5645 {{Special:search}}
5646 !! result
5647 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
5648 </p>
5649 !! end
5650
5651 !! test
5652 Say the magic word
5653 !! input
5654 * {{PAGENAME}}
5655 * {{BASEPAGENAME}}
5656 * {{SUBPAGENAME}}
5657 * {{SUBPAGENAMEE}}
5658 * {{BASEPAGENAME}}
5659 * {{BASEPAGENAMEE}}
5660 * {{TALKPAGENAME}}
5661 * {{TALKPAGENAMEE}}
5662 * {{SUBJECTPAGENAME}}
5663 * {{SUBJECTPAGENAMEE}}
5664 * {{NAMESPACEE}}
5665 * {{NAMESPACE}}
5666 * {{TALKSPACE}}
5667 * {{TALKSPACEE}}
5668 * {{SUBJECTSPACE}}
5669 * {{SUBJECTSPACEE}}
5670 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
5671 !! result
5672 <ul><li> Parser test
5673 </li><li> Parser test
5674 </li><li> Parser test
5675 </li><li> Parser_test
5676 </li><li> Parser test
5677 </li><li> Parser_test
5678 </li><li> Talk:Parser test
5679 </li><li> Talk:Parser_test
5680 </li><li> Parser test
5681 </li><li> Parser_test
5682 </li><li>
5683 </li><li>
5684 </li><li> Talk
5685 </li><li> Talk
5686 </li><li>
5687 </li><li>
5688 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit" class="new" title="Template:Dynamic">Template:Dynamic</a>
5689 </li></ul>
5690
5691 !! end
5692 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
5693
5694 !! test
5695 Gallery
5696 !! input
5697 <gallery>
5698 image1.png |
5699 image2.gif|||||
5700
5701 image3|
5702 image4 |300px| centre
5703 image5.svg| http://///////
5704 [[x|xx]]]]
5705 * image6
5706 </gallery>
5707 !! result
5708 <table class="gallery" cellspacing="0" cellpadding="0"><tr><td><div class="gallerybox"><div style="height: 152px;">Image1.png</div><div class="gallerytext">
5709 </div></div></td>
5710 <td><div class="gallerybox"><div style="height: 152px;">Image2.gif</div><div class="gallerytext">
5711 ||||</div></div></td>
5712 <td><div class="gallerybox"><div style="height: 152px;">Image3</div><div class="gallerytext">
5713 </div></div></td>
5714 <td><div class="gallerybox"><div style="height: 152px;">Image4</div><div class="gallerytext">
5715 300px| centre</div></div></td>
5716 </tr><tr><td><div class="gallerybox"><div style="height: 152px;">Image5.svg</div><div class="gallerytext">
5717 <a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a></div></div></td>
5718 <td><div class="gallerybox"><div style="height: 152px;">* image6</div><div class="gallerytext">
5719 </div></div></td>
5720 </tr>
5721 </table>
5722
5723 !! end
5724
5725 !! test
5726 TODO: HTML Hex character encoding.
5727 !! input
5728 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
5729 !! result
5730 <p>JavaScript
5731 </p>
5732 !! end
5733
5734 !! test
5735 __FORCETOC__ override
5736 !! input
5737 __NEWSECTIONLINK__
5738 __FORCETOC__
5739 !! result
5740 <p><br />
5741 </p>
5742 !! end
5743
5744 !! test
5745 ISBN code coverage
5746 !! input
5747 ISBN 983&#x20;987
5748 !! result
5749 <p><a href="/index.php?title=Special:Booksources&amp;isbn=983" class="internal">ISBN 983</a>&#x20;987
5750 </p>
5751 !! end
5752
5753 !! test
5754 ISBN followed by 5 spaces
5755 !! input
5756 ISBN
5757 !! result
5758 <p>ISBN
5759 </p>
5760 !! end
5761
5762 !! test
5763 Double ISBN
5764 !! options
5765 disabled # Disabled until Bug 6560 resolved
5766 !! input
5767 ISBN ISBN 1234
5768 !! result
5769 <p>ISBN <a href="/wiki/index.php?title=Special:Booksources&amp;isbn=1234" class="internal">ISBN 1234</a>
5770 </p>
5771 !! end
5772
5773 !! test
5774 Double RFC
5775 !! input
5776 RFC RFC 1234
5777 !! result
5778 <p>RFC <a href="http://www.ietf.org/rfc/rfc1234.txt" class="external" title="http://www.ietf.org/rfc/rfc1234.txt">RFC 1234</a>
5779 </p>
5780 !! end
5781
5782 !! test
5783 Double RFC with a wiki link
5784 !! input
5785 RFC [[RFC 1234]]
5786 !! result
5787 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit" class="new" title="RFC 1234">RFC 1234</a>
5788 </p>
5789 !! end
5790
5791 !! test
5792 RFC code coverage
5793 !! input
5794 RFC 983&#x20;987
5795 !! result
5796 <p><a href="http://www.ietf.org/rfc/rfc983.txt" class="external" title="http://www.ietf.org/rfc/rfc983.txt">RFC 983</a>&#x20;987
5797 </p>
5798 !! end
5799
5800 !! test
5801 Centre-aligned image
5802 !! input
5803 [[Image:foobar.jpg|centre]]
5804 !! result
5805 <div class="center"><div class="floatnone"><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></div>
5806
5807 !!end
5808
5809 !! test
5810 None-aligned image
5811 !! input
5812 [[Image:foobar.jpg|none]]
5813 !! result
5814 <div class="floatnone"><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>
5815
5816 !!end
5817
5818 !! test
5819 Width + Height sized image (using px) (height is ignored)
5820 !! input
5821 [[Image:foobar.jpg|640x480px]]
5822 !! result
5823 <p><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" alt="" width="640" height="73" longdesc="/wiki/Image:Foobar.jpg" /></a>
5824 </p>
5825 !!end
5826
5827 !! test
5828 Another italics / bold test
5829 !! input
5830 ''' ''x'
5831 !! result
5832 <pre>'<i> </i>x'
5833 </pre>
5834 !!end
5835
5836 # Note the results may be incorrect, as parserTest output included this:
5837 # XML error: Mismatched tag at byte 6120:
5838 # ...<dd> </dt></dl> </dd...
5839 !! test
5840 TODO: dt/dd/dl test
5841 !! input
5842 :;;;::
5843 !! result
5844 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
5845 </dt></dl>
5846 </dd></dl>
5847 </dd></dl>
5848 </dd></dl>
5849 </dd></dl>
5850 </dd></dl>
5851
5852 !!end
5853
5854 #
5855 #
5856 #
5857
5858 TODO:
5859 more images
5860 more tables
5861 math
5862 character entities
5863 and much more
5864 Try for 100% code coverage