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