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