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