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