Revert 17507 and 17518; more weird screwing about with headers, messing up styles.
[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 Definition list for indentation only
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 news link 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><a href="/index.php?title=Loop1&amp;action=edit" class="new" title="Loop1">loop1</a><!-- 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 !! test
2830 {{#special:}} page name, known
2831 !! options
2832 msg
2833 !! input
2834 {{#special:Recentchanges}}
2835 !! result
2836 Special:Recentchanges
2837 !! end
2838
2839 !! test
2840 {{#special:}} page name, unknown
2841 !! options
2842 msg
2843 !! input
2844 {{#special:foobarnonexistent}}
2845 !! result
2846 No such special page
2847 !! end
2848
2849 ###
2850 ### Images
2851 ###
2852 !! test
2853 Simple image
2854 !! input
2855 [[Image:foobar.jpg]]
2856 !! result
2857 <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>
2858 </p>
2859 !! end
2860
2861 !! test
2862 Right-aligned image
2863 !! input
2864 [[Image:foobar.jpg|right]]
2865 !! result
2866 <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>
2867
2868 !! end
2869
2870 !! test
2871 Image with caption
2872 !! input
2873 [[Image:foobar.jpg|right|Caption text]]
2874 !! result
2875 <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>
2876
2877 !! end
2878
2879 !! test
2880 Image with frame and link
2881 !! input
2882 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2883 !! result
2884 <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>
2885
2886 !! end
2887
2888 !! test
2889 Link to image page- image page normally doesn't exists, hence edit link
2890 TODO: Add test with existing image page
2891 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2892 !! input
2893 [[:Image:test]]
2894 !! result
2895 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2896 </p>
2897 !! end
2898
2899 !! test
2900 Frameless image caption with a free URL
2901 !! input
2902 [[Image:foobar.jpg|http://example.com]]
2903 !! result
2904 <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>
2905 </p>
2906 !! end
2907
2908 !! test
2909 Thumbnail image caption with a free URL
2910 !! input
2911 [[Image:foobar.jpg|thumb|http://example.com]]
2912 !! result
2913 <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>
2914
2915 !! end
2916
2917 !! test
2918 BUG 1887: A ISBN with a thumbnail
2919 !! input
2920 [[Image:foobar.jpg|thumb|ISBN 12354]]
2921 !! result
2922 <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>
2923
2924 !! end
2925
2926 !! test
2927 BUG 1887: A RFC with a thumbnail
2928 !! input
2929 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2930 !! result
2931 <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>
2932
2933 !! end
2934
2935 !! test
2936 BUG 1887: A mailto link with a thumbnail
2937 !! input
2938 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2939 !! result
2940 <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>
2941
2942 !! end
2943
2944 !! test
2945 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2946 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2947 !! input
2948 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2949 !! result
2950 <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>
2951
2952 !! end
2953
2954 !! test
2955 BUG 1887, part 2: A <math> with a thumbnail- math enabled
2956 !! options
2957 math
2958 !! input
2959 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2960 !! result
2961 <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>
2962
2963 !! end
2964
2965 # Pending resolution to bug 368
2966 !! test
2967 BUG 648: Frameless image caption with a link
2968 !! input
2969 [[Image:foobar.jpg|text with a [[link]] in it]]
2970 !! result
2971 <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>
2972 </p>
2973 !! end
2974
2975 !! test
2976 BUG 648: Frameless image caption with a link (suffix)
2977 !! input
2978 [[Image:foobar.jpg|text with a [[link]]foo in it]]
2979 !! result
2980 <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>
2981 </p>
2982 !! end
2983
2984 !! test
2985 BUG 648: Frameless image caption with an interwiki link
2986 !! input
2987 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
2988 !! result
2989 <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>
2990 </p>
2991 !! end
2992
2993 !! test
2994 BUG 648: Frameless image caption with a piped interwiki link
2995 !! input
2996 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
2997 !! result
2998 <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>
2999 </p>
3000 !! end
3001
3002 !! test
3003 Escape HTML special chars in image alt text
3004 !! input
3005 [[Image:foobar.jpg|& < > "]]
3006 !! result
3007 <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>
3008 </p>
3009 !! end
3010
3011 !! test
3012 BUG 499: Alt text should have &#1234;, not &amp;1234;
3013 !! input
3014 [[Image:foobar.jpg|&#9792;]]
3015 !! result
3016 <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>
3017 </p>
3018 !! end
3019
3020 !! test
3021 Broken image caption with link
3022 !! input
3023 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3024 !! result
3025 <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.
3026 </p>
3027 !! end
3028
3029 !! test
3030 Image caption containing another image
3031 !! input
3032 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3033 !! result
3034 <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>
3035
3036 !! end
3037
3038 !! test
3039 Image caption containing a newline
3040 !! input
3041 [[Image:Foobar.jpg|This
3042 *is some text]]
3043 !! result
3044 <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>
3045 </p>
3046 !!end
3047
3048
3049 !! test
3050 Bug 3090: External links other than http: in image captions
3051 !! input
3052 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3053 !! result
3054 <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>
3055
3056 !! end
3057
3058
3059 ###
3060 ### Subpages
3061 ###
3062 !! article
3063 Subpage test/subpage
3064 !! text
3065 foo
3066 !! endarticle
3067
3068 !! test
3069 Subpage link
3070 !! options
3071 subpage title=[[Subpage test]]
3072 !! input
3073 [[/subpage]]
3074 !! result
3075 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3076 </p>
3077 !! end
3078
3079 !! test
3080 Subpage noslash link
3081 !! options
3082 subpage title=[[Subpage test]]
3083 !!input
3084 [[/subpage/]]
3085 !! result
3086 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3087 </p>
3088 !! end
3089
3090 !! test
3091 Disabled subpages
3092 !! input
3093 [[/subpage]]
3094 !! result
3095 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
3096 </p>
3097 !! end
3098
3099 !! test
3100 BUG 561: {{/Subpage}}
3101 !! options
3102 subpage title=[[Page]]
3103 !! input
3104 {{/Subpage}}
3105 !! result
3106 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
3107 </p>
3108 !! end
3109
3110 ###
3111 ### Categories
3112 ###
3113 !! article
3114 Category:MediaWiki User's Guide
3115 !! text
3116 blah
3117 !! endarticle
3118
3119 !! test
3120 Link to category
3121 !! input
3122 [[:Category:MediaWiki User's Guide]]
3123 !! result
3124 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3125 </p>
3126 !! end
3127
3128 !! test
3129 Simple category
3130 !! options
3131 cat
3132 !! input
3133 [[Category:MediaWiki User's Guide]]
3134 !! result
3135 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3136 !! end
3137
3138 ###
3139 ### Inter-language links
3140 ###
3141 !! test
3142 Inter-language links
3143 !! options
3144 ill
3145 !! input
3146 [[es:Alimento]]
3147 [[fr:Nourriture]]
3148 [[zh:&#39135;&#21697;]]
3149 !! result
3150 es:Alimento fr:Nourriture zh:食品
3151 !! end
3152
3153 ###
3154 ### Sections
3155 ###
3156 !! test
3157 Basic section headings
3158 !! input
3159 == Headline 1 ==
3160 Some text
3161
3162 ==Headline 2==
3163 More
3164 ===Smaller headline===
3165 Blah blah
3166 !! result
3167 <a name="Headline_1"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
3168 <p>Some text
3169 </p>
3170 <a name="Headline_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline">Headline 2</span></h2>
3171 <p>More
3172 </p>
3173 <a name="Smaller_headline"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a>]</span> <span class="mw-headline">Smaller headline</span></h3>
3174 <p>Blah blah
3175 </p>
3176 !! end
3177
3178 !! test
3179 Section headings with TOC
3180 !! input
3181 == Headline 1 ==
3182 === Subheadline 1 ===
3183 ===== Skipping a level =====
3184 ====== Skipping a level ======
3185
3186 == Headline 2 ==
3187 Some text
3188 ===Another headline===
3189 !! result
3190 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3191 <ul>
3192 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3193 <ul>
3194 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3195 <ul>
3196 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3197 <ul>
3198 <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>
3199 </ul>
3200 </li>
3201 </ul>
3202 </li>
3203 </ul>
3204 </li>
3205 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3206 <ul>
3207 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3208 </ul>
3209 </li>
3210 </ul>
3211 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3212 <a name="Headline_1"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a>]</span> <span class="mw-headline"> Headline 1 </span></h2>
3213 <a name="Subheadline_1"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a>]</span> <span class="mw-headline"> Subheadline 1 </span></h3>
3214 <a name="Skipping_a_level"></a><h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h5>
3215 <a name="Skipping_a_level_2"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a>]</span> <span class="mw-headline"> Skipping a level </span></h6>
3216 <a name="Headline_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a>]</span> <span class="mw-headline"> Headline 2 </span></h2>
3217 <p>Some text
3218 </p>
3219 <a name="Another_headline"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a>]</span> <span class="mw-headline">Another headline</span></h3>
3220
3221 !! end
3222
3223 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3224 !! test
3225 Handling of sections up to level 6 and beyond
3226 !! input
3227 = Level 1 Heading=
3228 == Level 2 Heading==
3229 === Level 3 Heading===
3230 ==== Level 4 Heading====
3231 ===== Level 5 Heading=====
3232 ====== Level 6 Heading======
3233 ======= Level 7 Heading=======
3234 ======== Level 8 Heading========
3235 ========= Level 9 Heading=========
3236 ========== Level 10 Heading==========
3237 !! result
3238 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3239 <ul>
3240 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3241 <ul>
3242 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3243 <ul>
3244 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3245 <ul>
3246 <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>
3247 <ul>
3248 <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>
3249 <ul>
3250 <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>
3251 <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>
3252 <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>
3253 <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>
3254 <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>
3255 </ul>
3256 </li>
3257 </ul>
3258 </li>
3259 </ul>
3260 </li>
3261 </ul>
3262 </li>
3263 </ul>
3264 </li>
3265 </ul>
3266 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3267 <a name="Level_1_Heading"></a><h1><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a>]</span> <span class="mw-headline"> Level 1 Heading</span></h1>
3268 <a name="Level_2_Heading"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a>]</span> <span class="mw-headline"> Level 2 Heading</span></h2>
3269 <a name="Level_3_Heading"></a><h3><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a>]</span> <span class="mw-headline"> Level 3 Heading</span></h3>
3270 <a name="Level_4_Heading"></a><h4><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a>]</span> <span class="mw-headline"> Level 4 Heading</span></h4>
3271 <a name="Level_5_Heading"></a><h5><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a>]</span> <span class="mw-headline"> Level 5 Heading</span></h5>
3272 <a name="Level_6_Heading"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a>]</span> <span class="mw-headline"> Level 6 Heading</span></h6>
3273 <a name=".3D_Level_7_Heading.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: = Level 7 Heading=">edit</a>]</span> <span class="mw-headline">= Level 7 Heading=</span></h6>
3274 <a name=".3D.3D_Level_8_Heading.3D.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: == Level 8 Heading==">edit</a>]</span> <span class="mw-headline">== Level 8 Heading==</span></h6>
3275 <a name=".3D.3D.3D_Level_9_Heading.3D.3D.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: === Level 9 Heading===">edit</a>]</span> <span class="mw-headline">=== Level 9 Heading===</span></h6>
3276 <a name=".3D.3D.3D.3D_Level_10_Heading.3D.3D.3D.3D"></a><h6><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ==== Level 10 Heading====">edit</a>]</span> <span class="mw-headline">==== Level 10 Heading====</span></h6>
3277
3278 !! end
3279
3280 !! test
3281 Resolving duplicate section names
3282 !! input
3283 == Foo bar ==
3284 == Foo bar ==
3285 !! result
3286 <a name="Foo_bar"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
3287 <a name="Foo_bar_2"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a>]</span> <span class="mw-headline"> Foo bar </span></h2>
3288
3289 !! end
3290
3291 !! article
3292 Template:sections
3293 !! text
3294 ===Section 1===
3295 ==Section 2==
3296 !! endarticle
3297
3298 !! test
3299 Template with sections, __NOTOC__
3300 !! input
3301 __NOTOC__
3302 ==Section 0==
3303 {{sections}}
3304 ==Section 4==
3305 !! result
3306 <a name="Section_0"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a>]</span> <span class="mw-headline">Section 0</span></h2>
3307 <a name="Section_1"></a><h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 1</span></h3>
3308 <a name="Section_2"></a><h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 2</span></h2>
3309 <a name="Section_4"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a>]</span> <span class="mw-headline">Section 4</span></h2>
3310
3311 !! end
3312
3313 !! test
3314 __NOEDITSECTION__ keyword
3315 !! input
3316 __NOEDITSECTION__
3317 ==Section 1==
3318 ==Section 2==
3319 !! result
3320 <a name="Section_1"></a><h2> <span class="mw-headline">Section 1</span></h2>
3321 <a name="Section_2"></a><h2> <span class="mw-headline">Section 2</span></h2>
3322
3323 !! end
3324
3325 !! test
3326 Link inside a section heading
3327 !! input
3328 ==Section with a [[Main Page|link]] in it==
3329 !! result
3330 <a name="Section_with_a_link_in_it"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a>]</span> <span class="mw-headline">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span></h2>
3331
3332 !! end
3333
3334
3335 !! test
3336 BUG 1219 URL next to image (good)
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 1219 URL next to image (broken)
3346 !! input
3347 http://example.com[[Image:foobar.jpg]]
3348 !! result
3349 <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>
3350 </p>
3351 !!end
3352
3353 !! test
3354 Bug 1186 news: in the middle of text
3355 !! input
3356 http://en.wikinews.org/wiki/Wikinews:Workplace
3357 !! result
3358 <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>
3359 </p>
3360 !!end
3361
3362
3363 !! test
3364 Namespaced link must have a title
3365 !! input
3366 [[Project:]]
3367 !! result
3368 <p>[[Project:]]
3369 </p>
3370 !!end
3371
3372 !! test
3373 Namespaced link must have a title (bad fragment version)
3374 !! input
3375 [[Project:#fragment]]
3376 !! result
3377 <p>[[Project:#fragment]]
3378 </p>
3379 !!end
3380
3381
3382 !! test
3383 div with no attributes
3384 !! input
3385 <div>HTML rocks</div>
3386 !! result
3387 <div>HTML rocks</div>
3388
3389 !! end
3390
3391 !! test
3392 div with double-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 single-quoted 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 unquoted attribute
3411 !! input
3412 <div id=rock>HTML rocks</div>
3413 !! result
3414 <div id="rock">HTML rocks</div>
3415
3416 !! end
3417
3418 !! test
3419 div with illegal double attributes
3420 !! input
3421 <div align="center" align="right">HTML rocks</div>
3422 !! result
3423 <div align="right">HTML rocks</div>
3424
3425 !!end
3426
3427 !! test
3428 HTML multiple attributes correction
3429 !! input
3430 <p class="error" class="awesome">Awesome!</p>
3431 !! result
3432 <p class="awesome">Awesome!</p>
3433
3434 !!end
3435
3436 !! test
3437 Table multiple attributes correction
3438 !! input
3439 {|
3440 !+ class="error" class="awesome"| status
3441 |}
3442 !! result
3443 <table>
3444 <tr>
3445 <th class="awesome"> status
3446 </th></tr></table>
3447
3448 !!end
3449
3450 !! test
3451 DIV IN UPPERCASE
3452 !! input
3453 <DIV ALIGN="center">HTML ROCKS</DIV>
3454 !! result
3455 <div align="center">HTML ROCKS</div>
3456
3457 !!end
3458
3459
3460 !! test
3461 text with amp in the middle of nowhere
3462 !! input
3463 Remember AT&T?
3464 !!result
3465 <p>Remember AT&amp;T?
3466 </p>
3467 !! end
3468
3469 !! test
3470 text with character entity: eacute
3471 !! input
3472 I always thought &eacute; was a cute letter.
3473 !! result
3474 <p>I always thought &eacute; was a cute letter.
3475 </p>
3476 !! end
3477
3478 !! test
3479 text with undefined character entity: xacute
3480 !! input
3481 I always thought &xacute; was a cute letter.
3482 !! result
3483 <p>I always thought &amp;xacute; was a cute letter.
3484 </p>
3485 !! end
3486
3487
3488 ###
3489 ### Media links
3490 ###
3491
3492 !! test
3493 Media link
3494 !! input
3495 [[Media:Foobar.jpg]]
3496 !! result
3497 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3498 </p>
3499 !! end
3500
3501 !! test
3502 Media link with text
3503 !! input
3504 [[Media:Foobar.jpg|A neat file to look at]]
3505 !! result
3506 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3507 </p>
3508 !! end
3509
3510 # FIXME: this is still bad HTML tag nesting
3511 !! test
3512 Media link with nasty text
3513 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3514 !! input
3515 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3516 !! result
3517 <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>
3518
3519 !! end
3520
3521 !! test
3522 Media link to nonexistent file (bug 1702)
3523 !! input
3524 [[Media:No such.jpg]]
3525 !! result
3526 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3527 </p>
3528 !! end
3529
3530 !! test
3531 Image link to nonexistent file (bug 1850 - good)
3532 !! input
3533 [[Image:No such.jpg]]
3534 !! result
3535 <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>
3536 </p>
3537 !! end
3538
3539 !! test
3540 :Image link to nonexistent file (bug 1850 - bad)
3541 !! input
3542 [[:Image:No such.jpg]]
3543 !! result
3544 <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>
3545 </p>
3546 !! end
3547
3548
3549
3550 !! test
3551 Character reference normalization in link text (bug 1938)
3552 !! input
3553 [[Main Page|this&that]]
3554 !! result
3555 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3556 </p>
3557 !!end
3558
3559 !! test
3560 Empty attribute crash test (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 Empty attribute crash test single-quotes (bug 2067)
3570 !! input
3571 <font color=''>foo</font>
3572 !! result
3573 <p><font color="">foo</font>
3574 </p>
3575 !! end
3576
3577 !! test
3578 Attribute test: equals, then nothing
3579 !! input
3580 <font color=>foo</font>
3581 !! result
3582 <p><font>foo</font>
3583 </p>
3584 !! end
3585
3586 !! test
3587 Attribute test: unquoted value
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: unquoted but illegal value (hash)
3597 !! input
3598 <font color=#x>foo</font>
3599 !! result
3600 <p><font color="#x">foo</font>
3601 </p>
3602 !! end
3603
3604 !! test
3605 Attribute test: no value
3606 !! input
3607 <font color>foo</font>
3608 !! result
3609 <p><font color="color">foo</font>
3610 </p>
3611 !! end
3612
3613 !! test
3614 Bug 2095: link with three closing brackets
3615 !! input
3616 [[Main Page]]]
3617 !! result
3618 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3619 </p>
3620 !! end
3621
3622 !! test
3623 Bug 2095: link with pipe and three closing brackets
3624 !! input
3625 [[Main Page|link]]]
3626 !! result
3627 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3628 </p>
3629 !! end
3630
3631 !! test
3632 Bug 2095: link with pipe and three closing brackets, version 2
3633 !! input
3634 [[Main Page|[http://example.com/]]]
3635 !! result
3636 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3637 </p>
3638 !! end
3639
3640
3641 ###
3642 ### Safety
3643 ###
3644
3645 !! article
3646 Template:Dangerous attribute
3647 !! text
3648 " onmouseover="alert(document.cookie)
3649 !! endarticle
3650
3651 !! article
3652 Template:Dangerous style attribute
3653 !! text
3654 border-size: expression(alert(document.cookie))
3655 !! endarticle
3656
3657 !! article
3658 Template:Div style
3659 !! text
3660 <div style="float: right; {{{1}}}">Magic div</div>
3661 !! endarticle
3662
3663 !! test
3664 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3665 !! input
3666 <div title="{{test}}"></div>
3667 !! result
3668 <div title="This is a test template"></div>
3669
3670 !! end
3671
3672 !! test
3673 Bug 2304: HTML attribute safety (dangerous template; 2309)
3674 !! input
3675 <div title="{{dangerous attribute}}"></div>
3676 !! result
3677 <div title=""></div>
3678
3679 !! end
3680
3681 !! test
3682 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3683 !! input
3684 <div style="{{dangerous style attribute}}"></div>
3685 !! result
3686 <div></div>
3687
3688 !! end
3689
3690 !! test
3691 Bug 2304: HTML attribute safety (safe parameter; 2309)
3692 !! input
3693 {{div style|width: 200px}}
3694 !! result
3695 <div style="float: right; width: 200px">Magic div</div>
3696
3697 !! end
3698
3699 !! test
3700 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3701 !! input
3702 {{div style|width: expression(alert(document.cookie))}}
3703 !! result
3704 <div>Magic div</div>
3705
3706 !! end
3707
3708 !! test
3709 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3710 !! input
3711 {{div style|"><script>alert(document.cookie)</script>}}
3712 !! result
3713 <div>Magic div</div>
3714
3715 !! end
3716
3717 !! test
3718 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3719 !! input
3720 {{div style|" ><script>alert(document.cookie)</script>}}
3721 !! result
3722 <div style="float: right;">Magic div</div>
3723
3724 !! end
3725
3726 !! test
3727 Bug 2304: HTML attribute safety (link)
3728 !! input
3729 <div title="[[Main Page]]"></div>
3730 !! result
3731 <div title="&#91;&#91;Main Page]]"></div>
3732
3733 !! end
3734
3735 !! test
3736 Bug 2304: HTML attribute safety (italics)
3737 !! input
3738 <div title="''foobar''"></div>
3739 !! result
3740 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3741
3742 !! end
3743
3744 !! test
3745 Bug 2304: HTML attribute safety (bold)
3746 !! input
3747 <div title="'''foobar'''"></div>
3748 !! result
3749 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3750
3751 !! end
3752
3753
3754 !! test
3755 Bug 2304: HTML attribute safety (ISBN)
3756 !! input
3757 <div title="ISBN 1234567890"></div>
3758 !! result
3759 <div title="&#73;SBN 1234567890"></div>
3760
3761 !! end
3762
3763 !! test
3764 Bug 2304: HTML attribute safety (RFC)
3765 !! input
3766 <div title="RFC 1234"></div>
3767 !! result
3768 <div title="&#82;FC 1234"></div>
3769
3770 !! end
3771
3772 !! test
3773 Bug 2304: HTML attribute safety (PMID)
3774 !! input
3775 <div title="PMID 1234567890"></div>
3776 !! result
3777 <div title="&#80;MID 1234567890"></div>
3778
3779 !! end
3780
3781 !! test
3782 Bug 2304: HTML attribute safety (web link)
3783 !! input
3784 <div title="http://example.com/"></div>
3785 !! result
3786 <div title="http&#58;//example.com/"></div>
3787
3788 !! end
3789
3790 !! test
3791 Bug 2304: HTML attribute safety (named web link)
3792 !! input
3793 <div title="[http://example.com/ link]"></div>
3794 !! result
3795 <div title="&#91;http&#58;//example.com/ link]"></div>
3796
3797 !! end
3798
3799 !! test
3800 Bug 3244: HTML attribute safety (extension; safe)
3801 !! input
3802 <div style="<nowiki>background:blue</nowiki>"></div>
3803 !! result
3804 <div style="background:blue"></div>
3805
3806 !! end
3807
3808 !! test
3809 Bug 3244: HTML attribute safety (extension; unsafe)
3810 !! input
3811 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3812 !! result
3813 <div></div>
3814
3815 !! end
3816
3817 !! test
3818 Math section safety when disabled
3819 !! input
3820 <math><script>alert(document.cookies);</script></math>
3821 !! result
3822 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3823 </p>
3824 !! end
3825
3826 # More MSIE fun discovered by Tom Gilder
3827
3828 !! test
3829 MSIE CSS safety test: spurious slash
3830 !! input
3831 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3832 !! result
3833 <div>evil</div>
3834
3835 !! end
3836
3837 !! test
3838 MSIE CSS safety test: hex code
3839 !! input
3840 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3841 !! result
3842 <div>evil</div>
3843
3844 !! end
3845
3846 !! test
3847 MSIE CSS safety test: comment in url
3848 !! input
3849 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3850 !! result
3851 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3852
3853 !! end
3854
3855 !! test
3856 MSIE CSS safety test: comment in expression
3857 !! input
3858 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3859 !! result
3860 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3861
3862 !! end
3863
3864
3865 !! test
3866 Table attribute legitimate extension
3867 !! input
3868 {|
3869 !+ style="<nowiki>color:blue</nowiki>"| status
3870 |}
3871 !! result
3872 <table>
3873 <tr>
3874 <th style="color:blue"> status
3875 </th></tr></table>
3876
3877 !!end
3878
3879 !! test
3880 Table attribute safety
3881 !! input
3882 {|
3883 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3884 |}
3885 !! result
3886 <table>
3887 <tr>
3888 <th> status
3889 </th></tr></table>
3890
3891 !! end
3892
3893
3894 !! article
3895 Template:Identity
3896 !! text
3897 {{{1}}}
3898 !! endarticle
3899
3900 !! test
3901 Expansion of multi-line templates in attribute values (bug 6255)
3902 !! input
3903 <div style="background: {{identity|#00FF00}}">-</div>
3904 !! result
3905 <div style="background: #00FF00">-</div>
3906
3907 !! end
3908
3909
3910 !! test
3911 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3912 !! input
3913 <div style="background:
3914 #00FF00">-</div>
3915 !! result
3916 <div style="background: #00FF00">-</div>
3917
3918 !! end
3919
3920 !! test
3921 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
3922 !! input
3923 <div style="background: &#10;#00FF00">-</div>
3924 !! result
3925 <div style="background: &#10;#00FF00">-</div>
3926
3927 !! end
3928
3929 ###
3930 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3931 ###
3932 !! test
3933 Parser hook: empty input
3934 !! input
3935 <tag></tag>
3936 !! result
3937 <pre>
3938 string(0) ""
3939 array(0) {
3940 }
3941 </pre>
3942
3943 !! end
3944
3945 !! test
3946 Parser hook: empty input using terminated empty elements
3947 !! input
3948 <tag/>
3949 !! result
3950 <pre>
3951 NULL
3952 array(0) {
3953 }
3954 </pre>
3955
3956 !! end
3957
3958 !! test
3959 Parser hook: empty input using terminated empty elements (space before)
3960 !! input
3961 <tag />
3962 !! result
3963 <pre>
3964 NULL
3965 array(0) {
3966 }
3967 </pre>
3968
3969 !! end
3970
3971 !! test
3972 Parser hook: basic input
3973 !! input
3974 <tag>input</tag>
3975 !! result
3976 <pre>
3977 string(5) "input"
3978 array(0) {
3979 }
3980 </pre>
3981
3982 !! end
3983
3984
3985 !! test
3986 Parser hook: case insensetive
3987 !! input
3988 <TAG>input</TAG>
3989 !! result
3990 <pre>
3991 string(5) "input"
3992 array(0) {
3993 }
3994 </pre>
3995
3996 !! end
3997
3998
3999 !! test
4000 Parser hook: case insensetive, redux
4001 !! input
4002 <TaG>input</TAg>
4003 !! result
4004 <pre>
4005 string(5) "input"
4006 array(0) {
4007 }
4008 </pre>
4009
4010 !! end
4011
4012 !! test
4013 Parser hook: nested tags
4014 !! options
4015 noxml
4016 !! input
4017 <tag><tag></tag></tag>
4018 !! result
4019 <pre>
4020 string(5) "<tag>"
4021 array(0) {
4022 }
4023 </pre>&lt;/tag&gt;
4024
4025 !! end
4026
4027 !! test
4028 Parser hook: basic arguments
4029 !! input
4030 <tag width=200 height = "100" depth = '50' square></tag>
4031 !! result
4032 <pre>
4033 string(0) ""
4034 array(4) {
4035 ["width"]=>
4036 string(3) "200"
4037 ["height"]=>
4038 string(3) "100"
4039 ["depth"]=>
4040 string(2) "50"
4041 ["square"]=>
4042 string(6) "square"
4043 }
4044 </pre>
4045
4046 !! end
4047
4048 !! test
4049 Parser hook: argument containing a forward slash (bug 5344)
4050 !! input
4051 <tag filename='/tmp/bla'></tag>
4052 !! result
4053 <pre>
4054 string(0) ""
4055 array(1) {
4056 ["filename"]=>
4057 string(8) "/tmp/bla"
4058 }
4059 </pre>
4060
4061 !! end
4062
4063 !! test
4064 Parser hook: empty input using terminated empty elements (bug 2374)
4065 !! input
4066 <tag foo=bar/>text
4067 !! result
4068 <pre>
4069 NULL
4070 array(1) {
4071 ["foo"]=>
4072 string(3) "bar"
4073 }
4074 </pre>text
4075
4076 !! end
4077
4078 # </tag> should be output literally since there is no matching tag that begins it
4079 !! test
4080 Parser hook: basic arguments using terminated empty elements (bug 2374)
4081 !! input
4082 <tag width=200 height = "100" depth = '50' square/>
4083 other stuff
4084 </tag>
4085 !! result
4086 <pre>
4087 NULL
4088 array(4) {
4089 ["width"]=>
4090 string(3) "200"
4091 ["height"]=>
4092 string(3) "100"
4093 ["depth"]=>
4094 string(2) "50"
4095 ["square"]=>
4096 string(6) "square"
4097 }
4098 </pre>
4099 <p>other stuff
4100 &lt;/tag&gt;
4101 </p>
4102 !! end
4103
4104 ###
4105 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4106 ###
4107
4108 !! test
4109 Parser hook: static parser hook not inside a comment
4110 !! input
4111 <statictag>hello, world</statictag>
4112 <statictag action=flush/>
4113 !! result
4114 <p>hello, world
4115 </p>
4116 !! end
4117
4118
4119 !! test
4120 Parser hook: static parser hook inside a comment
4121 !! input
4122 <!-- <statictag>hello, world</statictag> -->
4123 <statictag action=flush/>
4124 !! result
4125 <p><br />
4126 </p>
4127 !! end
4128
4129 # Nested template calls; this case was broken by Parser.php rev 1.506,
4130 # since reverted.
4131
4132 !! article
4133 Template:One-parameter
4134 !! text
4135 (My parameter is: {{{1}}})
4136 !! endarticle
4137
4138 !! article
4139 Template:Map-one-parameter
4140 !! text
4141 {{{{{1}}}|{{{2}}}}}
4142 !! endarticle
4143
4144 !! test
4145 Nested template calls
4146 !! input
4147 {{Map-one-parameter|One-parameter|param}}
4148 !! result
4149 <p>(My parameter is: param)
4150 </p>
4151 !! end
4152
4153
4154 ###
4155 ### Sanitizer
4156 ###
4157 !! test
4158 Sanitizer: Closing of open tags
4159 !! input
4160 <s></s><table></table>
4161 !! result
4162 <s></s><table></table>
4163
4164 !! end
4165
4166 !! test
4167 Sanitizer: Closing of open but not closed tags
4168 !! input
4169 <s>foo
4170 !! result
4171 <p><s>foo</s>
4172 </p>
4173 !! end
4174
4175 !! test
4176 Sanitizer: Closing of closed but not open tags
4177 !! input
4178 </s>
4179 !! result
4180 <p>&lt;/s&gt;
4181 </p>
4182 !! end
4183
4184 !! test
4185 Sanitizer: Closing of closed but not open table tags
4186 !! input
4187 Table not started</td></tr></table>
4188 !! result
4189 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4190 </p>
4191 !! end
4192
4193 !! test
4194 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4195 !! input
4196 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4197 !! result
4198 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4199 </p>
4200 !! end
4201
4202 !! test
4203 Sanitizer: Validating the contents of the id attribute (bug 4515)
4204 !! options
4205 disabled
4206 !! input
4207 <br id=9 />
4208 !! result
4209 Something, but defenetly not <br id="9" />...
4210 !! end
4211
4212 !! test
4213 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4214 !! options
4215 disabled
4216 !! input
4217 <br id="foo" /><br id="foo" />
4218 !! result
4219 Something need to be done. foo-2 ?
4220 !! end
4221
4222 !! test
4223 Language converter: output gets cut off unexpectedly (bug 5757)
4224 !! options
4225 language=zh
4226 !! input
4227 this bit is safe: }-
4228
4229 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4230
4231 then we get cut off here: }-
4232
4233 all additional text is vanished
4234 !! result
4235 <p>this bit is safe: }-
4236 </p><p>but if we add a conversion instance: xxx
4237 </p><p>then we get cut off here: }-
4238 </p><p>all additional text is vanished
4239 </p>
4240 !! end
4241
4242 !! test
4243 Self closed html pairs (bug 5487)
4244 !! options
4245 !! input
4246 <center><font id="bug" />Centered text</center>
4247 <div><font id="bug2" />In div text</div>
4248 !! result
4249 <center>&lt;font id="bug" /&gt;Centered text</center>
4250 <div>&lt;font id="bug2" /&gt;In div text</div>
4251
4252 !! end
4253
4254 #
4255 #
4256 #
4257
4258 !! test
4259 HTML bullet list, closed tags (bug 5497)
4260 !! input
4261 <ul>
4262 <li>One</li>
4263 <li>Two</li>
4264 </ul>
4265 !! result
4266 <ul>
4267 <li>One</li>
4268 <li>Two</li>
4269 </ul>
4270
4271 !! end
4272
4273 !! test
4274 TODO: HTML bullet list, unclosed tags (bug 5497)
4275 !! input
4276 <ul>
4277 <li>One
4278 <li>Two
4279 </ul>
4280 !! result
4281 <ul>
4282 <li>One
4283 </li><li>Two
4284 </li></ul>
4285
4286 !! end
4287
4288 !! test
4289 HTML ordered list, closed tags (bug 5497)
4290 !! input
4291 <ol>
4292 <li>One</li>
4293 <li>Two</li>
4294 </ol>
4295 !! result
4296 <ol>
4297 <li>One</li>
4298 <li>Two</li>
4299 </ol>
4300
4301 !! end
4302
4303 !! test
4304 TODO: HTML ordered list, unclosed tags (bug 5497)
4305 !! input
4306 <ol>
4307 <li>One
4308 <li>Two
4309 </ol>
4310 !! result
4311 <ol>
4312 <li>One
4313 </li><li>Two
4314 </li></ol>
4315
4316 !! end
4317
4318 !! test
4319 HTML nested bullet list, closed tags (bug 5497)
4320 !! input
4321 <ul>
4322 <li>One</li>
4323 <li>Two:
4324 <ul>
4325 <li>Sub-one</li>
4326 <li>Sub-two</li>
4327 </ul>
4328 </li>
4329 </ul>
4330 !! result
4331 <ul>
4332 <li>One</li>
4333 <li>Two:
4334 <ul>
4335 <li>Sub-one</li>
4336 <li>Sub-two</li>
4337 </ul>
4338 </li>
4339 </ul>
4340
4341 !! end
4342
4343 !! test
4344 TODO: HTML nested bullet list, open tags (bug 5497)
4345 !! input
4346 <ul>
4347 <li>One
4348 <li>Two:
4349 <ul>
4350 <li>Sub-one
4351 <li>Sub-two
4352 </ul>
4353 </ul>
4354 !! result
4355 <ul>
4356 <li>One
4357 </li><li>Two:
4358 <ul>
4359 <li>Sub-one
4360 </li><li>Sub-two
4361 </li></ul>
4362 </li></ul>
4363
4364 !! end
4365
4366 !! test
4367 HTML nested ordered list, closed tags (bug 5497)
4368 !! input
4369 <ol>
4370 <li>One</li>
4371 <li>Two:
4372 <ol>
4373 <li>Sub-one</li>
4374 <li>Sub-two</li>
4375 </ol>
4376 </li>
4377 </ol>
4378 !! result
4379 <ol>
4380 <li>One</li>
4381 <li>Two:
4382 <ol>
4383 <li>Sub-one</li>
4384 <li>Sub-two</li>
4385 </ol>
4386 </li>
4387 </ol>
4388
4389 !! end
4390
4391 !! test
4392 TODO: HTML nested ordered list, open tags (bug 5497)
4393 !! input
4394 <ol>
4395 <li>One
4396 <li>Two:
4397 <ol>
4398 <li>Sub-one
4399 <li>Sub-two
4400 </ol>
4401 </ol>
4402 !! result
4403 <ol>
4404 <li>One
4405 </li><li>Two:
4406 <ol>
4407 <li>Sub-one
4408 </li><li>Sub-two
4409 </li></ol>
4410 </li></ol>
4411
4412 !! end
4413
4414 !! test
4415 HTML ordered list item with parameters oddity
4416 !! input
4417 <ol><li id="fragment">One</li></ol>
4418 !! result
4419 <ol><li id="fragment">One</li></ol>
4420
4421 !! end
4422
4423 !!test
4424 bug 5918: autonumbering
4425 !! input
4426 [http://first/] [http://second] [ftp://ftp]
4427
4428 ftp://inlineftp
4429
4430 [mailto:enclosed@mail.tld With target]
4431
4432 [mailto:enclosed@mail.tld]
4433
4434 mailto:inline@mail.tld
4435 !! result
4436 <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>
4437 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4438 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4439 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4440 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4441 </p>
4442 !! end
4443
4444
4445 #
4446 # Security and HTML correctness
4447 # From Nick Jenkins' fuzz testing
4448 #
4449
4450 !! test
4451 Fuzz testing: Parser13
4452 !! input
4453 {|
4454 | http://a|
4455 !! result
4456 <table>
4457 <tr>
4458 <td>
4459 </td>
4460 </tr>
4461 </table>
4462
4463 !! end
4464
4465 !! test
4466 Fuzz testing: Parser14
4467 !! input
4468 == onmouseover= ==
4469 http://__TOC__
4470 !! result
4471 <a name="onmouseover.3D"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a>]</span> <span class="mw-headline"> onmouseover= </span></h2>
4472 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4473 <ul>
4474 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4475 </ul>
4476 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4477
4478 !! end
4479
4480 !! test
4481 Fuzz testing: Parser14-table
4482 !! input
4483 ==a==
4484 {| STYLE=__TOC__
4485 !! result
4486 <a name="a"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a>]</span> <span class="mw-headline">a</span></h2>
4487 <table style="&#95;_TOC&#95;_">
4488 <tr><td></td></tr>
4489 </table>
4490
4491 !! end
4492
4493 # Known to produce bogus xml (extra </td>)
4494 !! test
4495 Fuzz testing: Parser16
4496 !! options
4497 noxml
4498 !! input
4499 {|
4500 !https://||||||
4501 !! result
4502 <table>
4503 <tr>
4504 <th>https://</th><th></th><th></th><th>
4505 </td>
4506 </tr>
4507 </table>
4508
4509 !! end
4510
4511 !! test
4512 Fuzz testing: Parser21
4513 !! input
4514 {|
4515 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4516 |
4517 !! result
4518 <table>
4519 <tr>
4520 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4521 </th><td>
4522 </td>
4523 </tr>
4524 </table>
4525
4526 !! end
4527
4528 !! test
4529 Fuzz testing: Parser22
4530 !! input
4531 http://===r:::https://b
4532
4533 {|
4534 !!result
4535 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4536 </p>
4537 <table>
4538 <tr><td></td></tr>
4539 </table>
4540
4541 !! end
4542
4543 # Known to produce bad XML for now
4544 !! test
4545 Fuzz testing: Parser24
4546 !! options
4547 noxml
4548 !! input
4549 {|
4550 {{{|
4551 <u CLASS=
4552 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4553 <br style="onmouseover='alert(document.cookie);' " />
4554
4555 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4556 |
4557 !! result
4558 <table>
4559
4560 <u class="&#124;">} &gt;
4561 <br style="onmouseover='alert(document.cookie);'" />
4562
4563 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4564 <tr>
4565 <td></u>
4566 </td>
4567 </tr>
4568 </table>
4569
4570 !! end
4571
4572 # Known to produce bad XML for now
4573 !!test
4574 Fuzz testing: Parser25 (bug 6055)
4575 !! options
4576 noxml
4577 !! input
4578 {{{
4579 |
4580 <LI CLASS=||
4581 >
4582 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4583 !! result
4584 <li class="&#124;&#124;">
4585 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4586
4587 !! end
4588
4589 !!test
4590 Fuzz testing: URL adjacent extension (with space, clean)
4591 !! options
4592 !! input
4593 http://example.com <nowiki>junk</nowiki>
4594 !! result
4595 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
4596 </p>
4597 !!end
4598
4599 !!test
4600 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4601 !! options
4602 !! input
4603 http://example.com<nowiki>junk</nowiki>
4604 !! result
4605 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
4606 </p>
4607 !!end
4608
4609 !!test
4610 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4611 !! options
4612 !! input
4613 http://example.com<pre>junk</pre>
4614 !! result
4615 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4616
4617 !!end
4618
4619 !!test
4620 Fuzz testing: image with bogus manual thumbnail
4621 !!input
4622 [[Image:foobar.jpg|thumbnail= ]]
4623 !!result
4624 <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>
4625
4626 !!end
4627
4628 !! test
4629 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
4630 !! input
4631 <pre dir="&#10;"></pre>
4632 !! result
4633 <pre dir="&#10;"></pre>
4634
4635 !! end
4636
4637 !! test
4638 TODO: Parsing optional HTML elements (Bug 6171)
4639 !! options
4640 !! input
4641 <table>
4642 <tr>
4643 <td> Some tabular data</td>
4644 <td> More tabular data ...
4645 <td> And yet som tabular data</td>
4646 </tr>
4647 </table>
4648 !! result
4649 <table>
4650 <tr>
4651 <td> Some tabular data</td>
4652 <td> More tabular data ...
4653 </td><td> And yet som tabular data</td>
4654 </tr>
4655 </table>
4656
4657 !! end
4658
4659 !! test
4660 Correct handling of <td>, <tr> (Bug 6171)
4661 !! options
4662 !! input
4663 <table>
4664 <tr>
4665 <td> Some tabular data</td>
4666 <td> More tabular data ...</td>
4667 <td> And yet som tabular data</td>
4668 </tr>
4669 </table>
4670 !! result
4671 <table>
4672 <tr>
4673 <td> Some tabular data</td>
4674 <td> More tabular data ...</td>
4675 <td> And yet som tabular data</td>
4676 </tr>
4677 </table>
4678
4679 !! end
4680
4681
4682 !! test
4683 Parsing crashing regression (fr:JavaScript)
4684 !! input
4685 </body></x>
4686 !! result
4687 <p>&lt;/body&gt;&lt;/x&gt;
4688 </p>
4689 !! end
4690
4691 !! test
4692 Inline wiki vs wiki block nesting
4693 !! input
4694 '''Bold paragraph
4695
4696 New wiki paragraph
4697 !! result
4698 <p><b>Bold paragraph</b>
4699 </p><p>New wiki paragraph
4700 </p>
4701 !! end
4702
4703 !! test
4704 TODO: Inline HTML vs wiki block nesting
4705 !! input
4706 <b>Bold paragraph
4707
4708 New wiki paragraph
4709 !! result
4710 <p><b>Bold paragraph</b>
4711 </p><p>New wiki paragraph
4712 </p>
4713 !! end
4714
4715
4716 !!test
4717 TODO: Mixing markup for italics and bold
4718 !! options
4719 !! input
4720 '''bold''''''bold''bolditalics'''''
4721 !! result
4722 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4723 </p>
4724 !! end
4725
4726
4727 !! article
4728 Xyzzyx
4729 !! text
4730 Article for special page transclusion test
4731 !! endarticle
4732
4733 !! test
4734 Special page transclusion
4735 !! options
4736 !! input
4737 {{Special:Prefixindex/Xyzzyx}}
4738 !! result
4739 <p><br />
4740 </p>
4741 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4742
4743 !! end
4744
4745 !! test
4746 Special page transclusion twice (bug 5021)
4747 !! options
4748 !! input
4749 {{Special:Prefixindex/Xyzzyx}}
4750 {{Special:Prefixindex/Xyzzyx}}
4751 !! result
4752 <p><br />
4753 </p>
4754 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4755 <p><br />
4756 </p>
4757 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4758
4759 !! end
4760
4761 !! test
4762 Invalid header with following text
4763 !! input
4764 = x = y
4765 !! result
4766 <p>= x = y
4767 </p>
4768 !! end
4769
4770
4771 !! test
4772 Section extraction test (section 0)
4773 !! options
4774 section=0
4775 !! input
4776 start
4777 ==a==
4778 ===aa===
4779 ====aaa====
4780 ==b==
4781 ===ba===
4782 ===bb===
4783 ====bba====
4784 ===bc===
4785 ==c==
4786 ===ca===
4787 !! result
4788 start
4789 !! end
4790
4791 !! test
4792 Section extraction test (section 1)
4793 !! options
4794 section=1
4795 !! input
4796 start
4797 ==a==
4798 ===aa===
4799 ====aaa====
4800 ==b==
4801 ===ba===
4802 ===bb===
4803 ====bba====
4804 ===bc===
4805 ==c==
4806 ===ca===
4807 !! result
4808 ==a==
4809 ===aa===
4810 ====aaa====
4811 !! end
4812
4813 !! test
4814 Section extraction test (section 2)
4815 !! options
4816 section=2
4817 !! input
4818 start
4819 ==a==
4820 ===aa===
4821 ====aaa====
4822 ==b==
4823 ===ba===
4824 ===bb===
4825 ====bba====
4826 ===bc===
4827 ==c==
4828 ===ca===
4829 !! result
4830 ===aa===
4831 ====aaa====
4832 !! end
4833
4834 !! test
4835 Section extraction test (section 3)
4836 !! options
4837 section=3
4838 !! input
4839 start
4840 ==a==
4841 ===aa===
4842 ====aaa====
4843 ==b==
4844 ===ba===
4845 ===bb===
4846 ====bba====
4847 ===bc===
4848 ==c==
4849 ===ca===
4850 !! result
4851 ====aaa====
4852 !! end
4853
4854 !! test
4855 Section extraction test (section 4)
4856 !! options
4857 section=4
4858 !! input
4859 start
4860 ==a==
4861 ===aa===
4862 ====aaa====
4863 ==b==
4864 ===ba===
4865 ===bb===
4866 ====bba====
4867 ===bc===
4868 ==c==
4869 ===ca===
4870 !! result
4871 ==b==
4872 ===ba===
4873 ===bb===
4874 ====bba====
4875 ===bc===
4876 !! end
4877
4878 !! test
4879 Section extraction test (section 5)
4880 !! options
4881 section=5
4882 !! input
4883 start
4884 ==a==
4885 ===aa===
4886 ====aaa====
4887 ==b==
4888 ===ba===
4889 ===bb===
4890 ====bba====
4891 ===bc===
4892 ==c==
4893 ===ca===
4894 !! result
4895 ===ba===
4896 !! end
4897
4898 !! test
4899 Section extraction test (section 6)
4900 !! options
4901 section=6
4902 !! input
4903 start
4904 ==a==
4905 ===aa===
4906 ====aaa====
4907 ==b==
4908 ===ba===
4909 ===bb===
4910 ====bba====
4911 ===bc===
4912 ==c==
4913 ===ca===
4914 !! result
4915 ===bb===
4916 ====bba====
4917 !! end
4918
4919 !! test
4920 Section extraction test (section 7)
4921 !! options
4922 section=7
4923 !! input
4924 start
4925 ==a==
4926 ===aa===
4927 ====aaa====
4928 ==b==
4929 ===ba===
4930 ===bb===
4931 ====bba====
4932 ===bc===
4933 ==c==
4934 ===ca===
4935 !! result
4936 ====bba====
4937 !! end
4938
4939 !! test
4940 Section extraction test (section 8)
4941 !! options
4942 section=8
4943 !! input
4944 start
4945 ==a==
4946 ===aa===
4947 ====aaa====
4948 ==b==
4949 ===ba===
4950 ===bb===
4951 ====bba====
4952 ===bc===
4953 ==c==
4954 ===ca===
4955 !! result
4956 ===bc===
4957 !! end
4958
4959 !! test
4960 Section extraction test (section 9)
4961 !! options
4962 section=9
4963 !! input
4964 start
4965 ==a==
4966 ===aa===
4967 ====aaa====
4968 ==b==
4969 ===ba===
4970 ===bb===
4971 ====bba====
4972 ===bc===
4973 ==c==
4974 ===ca===
4975 !! result
4976 ==c==
4977 ===ca===
4978 !! end
4979
4980 !! test
4981 Section extraction test (section 10)
4982 !! options
4983 section=10
4984 !! input
4985 start
4986 ==a==
4987 ===aa===
4988 ====aaa====
4989 ==b==
4990 ===ba===
4991 ===bb===
4992 ====bba====
4993 ===bc===
4994 ==c==
4995 ===ca===
4996 !! result
4997 ===ca===
4998 !! end
4999
5000 !! test
5001 Section extraction test (nonexistent section 11)
5002 !! options
5003 section=11
5004 !! input
5005 start
5006 ==a==
5007 ===aa===
5008 ====aaa====
5009 ==b==
5010 ===ba===
5011 ===bb===
5012 ====bba====
5013 ===bc===
5014 ==c==
5015 ===ca===
5016 !! result
5017 !! end
5018
5019 !! test
5020 Section extraction test with bogus heading (section 1)
5021 !! options
5022 section=1
5023 !! input
5024 ==a==
5025 ==bogus== not a legal section
5026 ==b==
5027 !! result
5028 ==a==
5029 ==bogus== not a legal section
5030 !! end
5031
5032 !! test
5033 Section extraction test with bogus heading (section 2)
5034 !! options
5035 section=2
5036 !! input
5037 ==a==
5038 ==bogus== not a legal section
5039 ==b==
5040 !! result
5041 ==b==
5042 !! end
5043
5044 !! test
5045 Section extraction test with comment after heading (section 1)
5046 !! options
5047 section=1
5048 !! input
5049 ==a==
5050 ==legal== <!-- a legal section -->
5051 ==b==
5052 !! result
5053 ==a==
5054 !! end
5055
5056 !! test
5057 Section extraction test with comment after heading (section 2)
5058 !! options
5059 section=2
5060 !! input
5061 ==a==
5062 ==legal== <!-- a legal section -->
5063 ==b==
5064 !! result
5065 ==legal== <!-- a legal section -->
5066 !! end
5067
5068 !! test
5069 Section extraction test with bogus <nowiki> heading (section 1)
5070 !! options
5071 section=1
5072 !! input
5073 ==a==
5074 ==bogus== <nowiki>not a legal section</nowiki>
5075 ==b==
5076 !! result
5077 ==a==
5078 ==bogus== <nowiki>not a legal section</nowiki>
5079 !! end
5080
5081 !! test
5082 Section extraction test with bogus <nowiki> heading (section 2)
5083 !! options
5084 section=2
5085 !! input
5086 ==a==
5087 ==bogus== <nowiki>not a legal section</nowiki>
5088 ==b==
5089 !! result
5090 ==b==
5091 !! end
5092
5093
5094 !! test
5095 Section extraction prefixed by comment (section 1) (bug 2587)
5096 !! options
5097 section=1
5098 !! input
5099 <!-- -->==sec1==
5100 ==sec2==
5101 !!result
5102 <!-- -->==sec1==
5103 !!end
5104
5105 !! test
5106 Section extraction prefixed by comment (section 2) (bug 2587)
5107 !! options
5108 section=2
5109 !! input
5110 <!-- -->==sec1==
5111 ==sec2==
5112 !!result
5113 ==sec2==
5114 !!end
5115
5116
5117 !! test
5118 Section extraction, mixed wiki and html (section 1) (bug 2607)
5119 !! options
5120 section=1
5121 !! input
5122 <h2>1</h2>
5123 one
5124 ==2==
5125 two
5126 ==3==
5127 three
5128 !! result
5129 <h2>1</h2>
5130 one
5131 !! end
5132
5133 !! test
5134 Section extraction, mixed wiki and html (section 2) (bug 2607)
5135 !! options
5136 section=2
5137 !! input
5138 <h2>1</h2>
5139 one
5140 ==2==
5141 two
5142 ==3==
5143 three
5144 !! result
5145 ==2==
5146 two
5147 !! end
5148
5149
5150 !! test
5151 Section extraction, heading surrounded by <noinclude> (bug 3342)
5152 !! options
5153 section=1
5154 !! input
5155 <noinclude>==a==</noinclude>
5156 text
5157 !! result
5158 <noinclude>==a==</noinclude>
5159 text
5160 !!end
5161
5162
5163 !! test
5164 Section extraction, HTML heading subsections (bug 5272)
5165 !! options
5166 section=1
5167 !! input
5168 <h2>a</h2>
5169 <h3>aa</h3>
5170 <h2>b</h2>
5171 !! result
5172 <h2>a</h2>
5173 <h3>aa</h3>
5174 !! end
5175
5176 !! test
5177 Section extraction, HTML headings should be ignored in extensions (bug 3476)
5178 !! options
5179 section=2
5180 !! input
5181 <h2>a</h2>
5182 <tag>
5183 <h2>not b</h2>
5184 </tag>
5185 <h2>b</h2>
5186 !! result
5187 <h2>b</h2>
5188 !! end
5189
5190 !! test
5191 Section replacement test (section 0)
5192 !! options
5193 replace=0,"xxx"
5194 !! input
5195 start
5196 ==a==
5197 ===aa===
5198 ====aaa====
5199 ==b==
5200 ===ba===
5201 ===bb===
5202 ====bba====
5203 ===bc===
5204 ==c==
5205 ===ca===
5206 !! result
5207 xxx
5208
5209 ==a==
5210 ===aa===
5211 ====aaa====
5212 ==b==
5213 ===ba===
5214 ===bb===
5215 ====bba====
5216 ===bc===
5217 ==c==
5218 ===ca===
5219 !! end
5220
5221 !! test
5222 Section replacement test (section 1)
5223 !! options
5224 replace=1,"xxx"
5225 !! input
5226 start
5227 ==a==
5228 ===aa===
5229 ====aaa====
5230 ==b==
5231 ===ba===
5232 ===bb===
5233 ====bba====
5234 ===bc===
5235 ==c==
5236 ===ca===
5237 !! result
5238 start
5239 xxx
5240
5241 ==b==
5242 ===ba===
5243 ===bb===
5244 ====bba====
5245 ===bc===
5246 ==c==
5247 ===ca===
5248 !! end
5249
5250 !! test
5251 Section replacement test (section 2)
5252 !! options
5253 replace=2,"xxx"
5254 !! input
5255 start
5256 ==a==
5257 ===aa===
5258 ====aaa====
5259 ==b==
5260 ===ba===
5261 ===bb===
5262 ====bba====
5263 ===bc===
5264 ==c==
5265 ===ca===
5266 !! result
5267 start
5268 ==a==
5269 xxx
5270
5271 ==b==
5272 ===ba===
5273 ===bb===
5274 ====bba====
5275 ===bc===
5276 ==c==
5277 ===ca===
5278 !! end
5279
5280 !! test
5281 Section replacement test (section 3)
5282 !! options
5283 replace=3,"xxx"
5284 !! input
5285 start
5286 ==a==
5287 ===aa===
5288 ====aaa====
5289 ==b==
5290 ===ba===
5291 ===bb===
5292 ====bba====
5293 ===bc===
5294 ==c==
5295 ===ca===
5296 !! result
5297 start
5298 ==a==
5299 ===aa===
5300 xxx
5301
5302 ==b==
5303 ===ba===
5304 ===bb===
5305 ====bba====
5306 ===bc===
5307 ==c==
5308 ===ca===
5309 !! end
5310
5311 !! test
5312 Section replacement test (section 4)
5313 !! options
5314 replace=4,"xxx"
5315 !! input
5316 start
5317 ==a==
5318 ===aa===
5319 ====aaa====
5320 ==b==
5321 ===ba===
5322 ===bb===
5323 ====bba====
5324 ===bc===
5325 ==c==
5326 ===ca===
5327 !! result
5328 start
5329 ==a==
5330 ===aa===
5331 ====aaa====
5332 xxx
5333
5334 ==c==
5335 ===ca===
5336 !! end
5337
5338 !! test
5339 Section replacement test (section 5)
5340 !! options
5341 replace=5,"xxx"
5342 !! input
5343 start
5344 ==a==
5345 ===aa===
5346 ====aaa====
5347 ==b==
5348 ===ba===
5349 ===bb===
5350 ====bba====
5351 ===bc===
5352 ==c==
5353 ===ca===
5354 !! result
5355 start
5356 ==a==
5357 ===aa===
5358 ====aaa====
5359 ==b==
5360 xxx
5361
5362 ===bb===
5363 ====bba====
5364 ===bc===
5365 ==c==
5366 ===ca===
5367 !! end
5368
5369 !! test
5370 Section replacement test (section 6)
5371 !! options
5372 replace=6,"xxx"
5373 !! input
5374 start
5375 ==a==
5376 ===aa===
5377 ====aaa====
5378 ==b==
5379 ===ba===
5380 ===bb===
5381 ====bba====
5382 ===bc===
5383 ==c==
5384 ===ca===
5385 !! result
5386 start
5387 ==a==
5388 ===aa===
5389 ====aaa====
5390 ==b==
5391 ===ba===
5392 xxx
5393
5394 ===bc===
5395 ==c==
5396 ===ca===
5397 !! end
5398
5399 !! test
5400 Section replacement test (section 7)
5401 !! options
5402 replace=7,"xxx"
5403 !! input
5404 start
5405 ==a==
5406 ===aa===
5407 ====aaa====
5408 ==b==
5409 ===ba===
5410 ===bb===
5411 ====bba====
5412 ===bc===
5413 ==c==
5414 ===ca===
5415 !! result
5416 start
5417 ==a==
5418 ===aa===
5419 ====aaa====
5420 ==b==
5421 ===ba===
5422 ===bb===
5423 xxx
5424
5425 ===bc===
5426 ==c==
5427 ===ca===
5428 !! end
5429
5430 !! test
5431 Section replacement test (section 8)
5432 !! options
5433 replace=8,"xxx"
5434 !! input
5435 start
5436 ==a==
5437 ===aa===
5438 ====aaa====
5439 ==b==
5440 ===ba===
5441 ===bb===
5442 ====bba====
5443 ===bc===
5444 ==c==
5445 ===ca===
5446 !! result
5447 start
5448 ==a==
5449 ===aa===
5450 ====aaa====
5451 ==b==
5452 ===ba===
5453 ===bb===
5454 ====bba====
5455 xxx
5456
5457 ==c==
5458 ===ca===
5459 !!end
5460
5461 !! test
5462 Section replacement test (section 9)
5463 !! options
5464 replace=9,"xxx"
5465 !! input
5466 start
5467 ==a==
5468 ===aa===
5469 ====aaa====
5470 ==b==
5471 ===ba===
5472 ===bb===
5473 ====bba====
5474 ===bc===
5475 ==c==
5476 ===ca===
5477 !! result
5478 start
5479 ==a==
5480 ===aa===
5481 ====aaa====
5482 ==b==
5483 ===ba===
5484 ===bb===
5485 ====bba====
5486 ===bc===
5487 xxx
5488 !! end
5489
5490 !! test
5491 Section replacement test (section 10)
5492 !! options
5493 replace=10,"xxx"
5494 !! input
5495 start
5496 ==a==
5497 ===aa===
5498 ====aaa====
5499 ==b==
5500 ===ba===
5501 ===bb===
5502 ====bba====
5503 ===bc===
5504 ==c==
5505 ===ca===
5506 !! result
5507 start
5508 ==a==
5509 ===aa===
5510 ====aaa====
5511 ==b==
5512 ===ba===
5513 ===bb===
5514 ====bba====
5515 ===bc===
5516 ==c==
5517 xxx
5518 !! end
5519
5520
5521 !! test
5522 Section extraction, HTML headings not at line boundaries (section 0)
5523 !! options
5524 section=0
5525 !! input
5526 <h2>Evil</h2><i>blah blah blah</i>
5527
5528 evil blah
5529
5530 <h2>Nice</h2>
5531
5532 nice blah
5533
5534 <i>extra evil</i><h2>Extra nasty</h2>
5535
5536 extra nasty
5537 !! result
5538 !! end
5539
5540 !! test
5541 Section extraction, HTML headings not at line boundaries (section 1)
5542 !! options
5543 section=1
5544 !! input
5545 <h2>Evil</h2><i>blah blah blah</i>
5546
5547 evil blah
5548
5549 <h2>Nice</h2>
5550
5551 nice blah
5552
5553 <i>extra evil</i><h2>Extra nasty</h2>
5554
5555 extra nasty
5556 !! result
5557 <h2>Evil</h2><i>blah blah blah</i>
5558
5559 evil blah
5560 !! end
5561
5562 !! test
5563 Section extraction, HTML headings not at line boundaries (section 2)
5564 !! options
5565 section=2
5566 !! input
5567 <h2>Evil</h2><i>blah blah blah</i>
5568
5569 evil blah
5570
5571 <h2>Nice</h2>
5572
5573 nice blah
5574
5575 <i>extra evil</i><h2>Extra nasty</h2>
5576
5577 extra nasty
5578 !! result
5579 <h2>Nice</h2>
5580
5581 nice blah
5582
5583 <i>extra evil</i>
5584 !! end
5585
5586 !! test
5587 Section extraction, HTML headings not at line boundaries (section 3)
5588 !! options
5589 section=3
5590 !! input
5591 <h2>Evil</h2><i>blah blah blah</i>
5592
5593 evil blah
5594
5595 <h2>Nice</h2>
5596
5597 nice blah
5598
5599 <i>extra evil</i><h2>Extra nasty</h2>
5600
5601 extra nasty
5602 !! result
5603 <h2>Extra nasty</h2>
5604
5605 extra nasty
5606 !! end
5607
5608
5609 !! test
5610 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5611 !! options
5612 section=1
5613 !! input
5614 ==a==
5615 a
5616 !! result
5617 ==a==
5618 a
5619 !! end
5620
5621 !! test
5622 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5623 !! options
5624 section=1
5625 !! input
5626 ==a==
5627 a
5628 !! result
5629 ==a==
5630 a
5631 !! end
5632
5633 !! test
5634 Handling of &#x0A; in URLs
5635 !! input
5636 **irc://&#x0A;a
5637 !! result
5638 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
5639 </li></ul>
5640 </li></ul>
5641
5642 !!end
5643
5644 !! test
5645 TODO: 5 quotes, code coverage +1 line
5646 !! input
5647 '''''
5648 !! result
5649 !! end
5650
5651 !! test
5652 Special:Search page linking.
5653 !! input
5654 {{Special:search}}
5655 !! result
5656 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
5657 </p>
5658 !! end
5659
5660 !! test
5661 Say the magic word
5662 !! input
5663 * {{PAGENAME}}
5664 * {{BASEPAGENAME}}
5665 * {{SUBPAGENAME}}
5666 * {{SUBPAGENAMEE}}
5667 * {{BASEPAGENAME}}
5668 * {{BASEPAGENAMEE}}
5669 * {{TALKPAGENAME}}
5670 * {{TALKPAGENAMEE}}
5671 * {{SUBJECTPAGENAME}}
5672 * {{SUBJECTPAGENAMEE}}
5673 * {{NAMESPACEE}}
5674 * {{NAMESPACE}}
5675 * {{TALKSPACE}}
5676 * {{TALKSPACEE}}
5677 * {{SUBJECTSPACE}}
5678 * {{SUBJECTSPACEE}}
5679 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
5680 !! result
5681 <ul><li> Parser test
5682 </li><li> Parser test
5683 </li><li> Parser test
5684 </li><li> Parser_test
5685 </li><li> Parser test
5686 </li><li> Parser_test
5687 </li><li> Talk:Parser test
5688 </li><li> Talk:Parser_test
5689 </li><li> Parser test
5690 </li><li> Parser_test
5691 </li><li>
5692 </li><li>
5693 </li><li> Talk
5694 </li><li> Talk
5695 </li><li>
5696 </li><li>
5697 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit" class="new" title="Template:Dynamic">Template:Dynamic</a>
5698 </li></ul>
5699
5700 !! end
5701 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
5702
5703 !! test
5704 Gallery
5705 !! input
5706 <gallery>
5707 image1.png |
5708 image2.gif|||||
5709
5710 image3|
5711 image4 |300px| centre
5712 image5.svg| http://///////
5713 [[x|xx]]]]
5714 * image6
5715 </gallery>
5716 !! result
5717 <table class="gallery" cellspacing="0" cellpadding="0"><tr><td><div class="gallerybox"><div style="height: 152px;">Image1.png</div><div class="gallerytext">
5718 </div></div></td>
5719 <td><div class="gallerybox"><div style="height: 152px;">Image2.gif</div><div class="gallerytext">
5720 ||||</div></div></td>
5721 <td><div class="gallerybox"><div style="height: 152px;">Image3</div><div class="gallerytext">
5722 </div></div></td>
5723 <td><div class="gallerybox"><div style="height: 152px;">Image4</div><div class="gallerytext">
5724 300px| centre</div></div></td>
5725 </tr><tr><td><div class="gallerybox"><div style="height: 152px;">Image5.svg</div><div class="gallerytext">
5726 <a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a></div></div></td>
5727 <td><div class="gallerybox"><div style="height: 152px;">* image6</div><div class="gallerytext">
5728 </div></div></td>
5729 </tr>
5730 </table>
5731
5732 !! end
5733
5734 !! test
5735 TODO: HTML Hex character encoding.
5736 !! input
5737 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
5738 !! result
5739 <p>JavaScript
5740 </p>
5741 !! end
5742
5743 !! test
5744 __FORCETOC__ override
5745 !! input
5746 __NEWSECTIONLINK__
5747 __FORCETOC__
5748 !! result
5749 <p><br />
5750 </p>
5751 !! end
5752
5753 !! test
5754 ISBN code coverage
5755 !! input
5756 ISBN 983&#x20;987
5757 !! result
5758 <p><a href="/index.php?title=Special:Booksources&amp;isbn=983" class="internal">ISBN 983</a>&#x20;987
5759 </p>
5760 !! end
5761
5762 !! test
5763 ISBN followed by 5 spaces
5764 !! input
5765 ISBN
5766 !! result
5767 <p>ISBN
5768 </p>
5769 !! end
5770
5771 !! test
5772 Double ISBN
5773 !! options
5774 disabled # Disabled until Bug 6560 resolved
5775 !! input
5776 ISBN ISBN 1234
5777 !! result
5778 <p>ISBN <a href="/wiki/index.php?title=Special:Booksources&amp;isbn=1234" class="internal">ISBN 1234</a>
5779 </p>
5780 !! end
5781
5782 !! test
5783 Double RFC
5784 !! input
5785 RFC RFC 1234
5786 !! result
5787 <p>RFC <a href="http://www.ietf.org/rfc/rfc1234.txt" class="external" title="http://www.ietf.org/rfc/rfc1234.txt">RFC 1234</a>
5788 </p>
5789 !! end
5790
5791 !! test
5792 Double RFC with a wiki link
5793 !! input
5794 RFC [[RFC 1234]]
5795 !! result
5796 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit" class="new" title="RFC 1234">RFC 1234</a>
5797 </p>
5798 !! end
5799
5800 !! test
5801 RFC code coverage
5802 !! input
5803 RFC 983&#x20;987
5804 !! result
5805 <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
5806 </p>
5807 !! end
5808
5809 !! test
5810 Centre-aligned image
5811 !! input
5812 [[Image:foobar.jpg|centre]]
5813 !! result
5814 <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>
5815
5816 !!end
5817
5818 !! test
5819 None-aligned image
5820 !! input
5821 [[Image:foobar.jpg|none]]
5822 !! result
5823 <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>
5824
5825 !!end
5826
5827 !! test
5828 Width + Height sized image (using px) (height is ignored)
5829 !! input
5830 [[Image:foobar.jpg|640x480px]]
5831 !! result
5832 <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>
5833 </p>
5834 !!end
5835
5836 !! test
5837 Another italics / bold test
5838 !! input
5839 ''' ''x'
5840 !! result
5841 <pre>'<i> </i>x'
5842 </pre>
5843 !!end
5844
5845 # Note the results may be incorrect, as parserTest output included this:
5846 # XML error: Mismatched tag at byte 6120:
5847 # ...<dd> </dt></dl> </dd...
5848 !! test
5849 TODO: dt/dd/dl test
5850 !! input
5851 :;;;::
5852 !! result
5853 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
5854 </dt></dl>
5855 </dd></dl>
5856 </dd></dl>
5857 </dd></dl>
5858 </dd></dl>
5859 </dd></dl>
5860
5861 !!end
5862
5863 #
5864 #
5865 #
5866
5867 TODO:
5868 more images
5869 more tables
5870 math
5871 character entities
5872 and much more
5873 Try for 100% code coverage