* Merged comment handling with the main loop of preprocessToDom(). This fixes a secti...
[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 !! article
2579 Template:Includeonly section
2580 !! text
2581 <includeonly>
2582 ==Includeonly section==
2583 </includeonly>
2584 ==Section T-1==
2585 !!endarticle
2586
2587 !! test
2588 Bug 6563: Edit link generation for section shown by <includeonly>
2589 !! input
2590 {{includeonly section}}
2591 !! result
2592 <a name="Includeonly_section"></a><h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline">Includeonly section</span></h2>
2593 <a name="Section_T-1"></a><h2><span class="editsection">[<a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a>]</span> <span class="mw-headline">Section T-1</span></h2>
2594
2595 !! end
2596
2597 # Uses same input as the contents of [[Template:Includeonly section]]
2598 !! test
2599 Bug 6563: Section extraction for section shown by <includeonly>
2600 !! options
2601 section=T-2
2602 !! input
2603 <includeonly>
2604 ==Includeonly section==
2605 </includeonly>
2606 ==Section T-2==
2607 !! result
2608 ==Section T-2==
2609 !! end
2610
2611 !! test
2612 Bug 6563: Edit link generation for section suppressed by <includeonly>
2613 !! input
2614 <includeonly>
2615 ==Includeonly section==
2616 </includeonly>
2617 ==Section 1==
2618 !! result
2619 <a name="Section_1"></a><h2><span class="editsection">[<a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a>]</span> <span class="mw-headline">Section 1</span></h2>
2620
2621 !! end
2622
2623 !! test
2624 Bug 6563: Section extraction for section suppressed by <includeonly>
2625 !! options
2626 section=1
2627 !! input
2628 <includeonly>
2629 ==Includeonly section==
2630 </includeonly>
2631 ==Section 1==
2632 !! result
2633 ==Section 1==
2634 !! end
2635
2636 ###
2637 ### Pre-save transform tests
2638 ###
2639 !! test
2640 pre-save transform: subst:
2641 !! options
2642 PST
2643 !! input
2644 {{subst:test}}
2645 !! result
2646 This is a test template
2647 !! end
2648
2649 !! test
2650 pre-save transform: normal template
2651 !! options
2652 PST
2653 !! input
2654 {{test}}
2655 !! result
2656 {{test}}
2657 !! end
2658
2659 !! test
2660 pre-save transform: nonexistant template
2661 !! options
2662 PST
2663 !! input
2664 {{thistemplatedoesnotexist}}
2665 !! result
2666 {{thistemplatedoesnotexist}}
2667 !! end
2668
2669
2670 !! test
2671 pre-save transform: subst magic variables
2672 !! options
2673 PST
2674 !! input
2675 {{subst:SITENAME}}
2676 !! result
2677 MediaWiki
2678 !! end
2679
2680 # This is bug 89, which I fixed. -- wtm
2681 !! test
2682 pre-save transform: subst: templates with parameters
2683 !! options
2684 pst
2685 !! input
2686 {{subst:paramtest|param="something else"}}
2687 !! result
2688 This is a test template with parameter "something else"
2689 !! end
2690
2691 !! article
2692 Template:nowikitest
2693 !! text
2694 <nowiki>'''not wiki'''</nowiki>
2695 !! endarticle
2696
2697 !! test
2698 pre-save transform: nowiki in subst (bug 1188)
2699 !! options
2700 pst
2701 !! input
2702 {{subst:nowikitest}}
2703 !! result
2704 <nowiki>'''not wiki'''</nowiki>
2705 !! end
2706
2707
2708 !! article
2709 Template:commenttest
2710 !! text
2711 This template has <!-- a comment --> in it.
2712 !! endarticle
2713
2714 !! test
2715 pre-save transform: comment in subst (bug 1936)
2716 !! options
2717 pst
2718 !! input
2719 {{subst:commenttest}}
2720 !! result
2721 This template has <!-- a comment --> in it.
2722 !! end
2723
2724 !! test
2725 pre-save transform: unclosed tag
2726 !! options
2727 pst noxml
2728 !! input
2729 <nowiki>'''not wiki'''
2730 !! result
2731 <nowiki>'''not wiki'''
2732 !! end
2733
2734 !! test
2735 pre-save transform: mixed tag case
2736 !! options
2737 pst noxml
2738 !! input
2739 <NOwiki>'''not wiki'''</noWIKI>
2740 !! result
2741 <NOwiki>'''not wiki'''</noWIKI>
2742 !! end
2743
2744 !! test
2745 pre-save transform: unclosed comment in <nowiki>
2746 !! options
2747 pst noxml
2748 !! input
2749 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2750 !! result
2751 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2752 !!end
2753
2754 !! article
2755 Template:dangerous
2756 !!text
2757 <span onmouseover="alert('crap')">Oh no</span>
2758 !!endarticle
2759
2760 !!test
2761 (confirming safety of fix for subst bug 1936)
2762 !! input
2763 {{Template:dangerous}}
2764 !! result
2765 <p><span>Oh no</span>
2766 </p>
2767 !! end
2768
2769 !! test
2770 pre-save transform: comment containing gallery (bug 5024)
2771 !! options
2772 pst
2773 !! input
2774 <!-- <gallery>data</gallery> -->
2775 !!result
2776 <!-- <gallery>data</gallery> -->
2777 !!end
2778
2779 !! test
2780 pre-save transform: comment containing extension
2781 !! options
2782 pst
2783 !! input
2784 <!-- <tag>data</tag> -->
2785 !!result
2786 <!-- <tag>data</tag> -->
2787 !!end
2788
2789 !! test
2790 pre-save transform: comment containing nowiki
2791 !! options
2792 pst
2793 !! input
2794 <!-- <nowiki>data</nowiki> -->
2795 !!result
2796 <!-- <nowiki>data</nowiki> -->
2797 !!end
2798
2799 !! test
2800 pre-save transform: comment containing math
2801 !! options
2802 pst
2803 !! input
2804 <!-- <math>data</math> -->
2805 !!result
2806 <!-- <math>data</math> -->
2807 !!end
2808
2809 !! test
2810 pre-save transform: <noinclude> in subst (bug 3298)
2811 !! options
2812 pst
2813 !! input
2814 {{subst:Includes}}
2815 !! result
2816 Foobar
2817 !! end
2818
2819 !! test
2820 pre-save transform: <onlyinclude> in subst (bug 3298)
2821 !! options
2822 pst
2823 !! input
2824 {{subst:Includes2}}
2825 !! result
2826 Foo
2827 !! end
2828
2829 !! test
2830 pre-save transform: context links ("pipe trick")
2831 !! options
2832 pst
2833 !! input
2834 [[Article (context)|]]
2835 [[Bar:Article|]]
2836 [[:Bar:Article|]]
2837 [[Bar:Article (context)|]]
2838 [[:Bar:Article (context)|]]
2839 [[|Article]]
2840 [[|Article (context)]]
2841 [[Bar:X (Y) Z|]]
2842 [[:Bar:X (Y) Z|]]
2843 !! result
2844 [[Article (context)|Article]]
2845 [[Bar:Article|Article]]
2846 [[:Bar:Article|Article]]
2847 [[Bar:Article (context)|Article]]
2848 [[:Bar:Article (context)|Article]]
2849 [[Article]]
2850 [[Article (context)]]
2851 [[Bar:X (Y) Z|X (Y) Z]]
2852 [[:Bar:X (Y) Z|X (Y) Z]]
2853 !! end
2854
2855 !! test
2856 pre-save transform: context links ("pipe trick") with interwiki prefix
2857 !! options
2858 pst
2859 !! input
2860 [[interwiki:Article|]]
2861 [[:interwiki:Article|]]
2862 [[interwiki:Bar:Article|]]
2863 [[:interwiki:Bar:Article|]]
2864 !! result
2865 [[interwiki:Article|Article]]
2866 [[:interwiki:Article|Article]]
2867 [[interwiki:Bar:Article|Bar:Article]]
2868 [[:interwiki:Bar:Article|Bar:Article]]
2869 !! end
2870
2871 !! test
2872 pre-save transform: context links ("pipe trick") with parens in title
2873 !! options
2874 pst title=[[Somearticle (context)]]
2875 !! input
2876 [[|Article]]
2877 !! result
2878 [[Article (context)|Article]]
2879 !! end
2880
2881 !! test
2882 pre-save transform: context links ("pipe trick") with comma in title
2883 !! options
2884 pst title=[[Someplace, Somewhere]]
2885 !! input
2886 [[|Otherplace]]
2887 [[Otherplace, Elsewhere|]]
2888 [[Otherplace, Elsewhere, Anywhere|]]
2889 !! result
2890 [[Otherplace, Somewhere|Otherplace]]
2891 [[Otherplace, Elsewhere|Otherplace]]
2892 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
2893 !! end
2894
2895 !! test
2896 pre-save transform: context links ("pipe trick") with parens and comma
2897 !! options
2898 pst title=[[Someplace (IGNORED), Somewhere]]
2899 !! input
2900 [[|Otherplace]]
2901 [[Otherplace (place), Elsewhere|]]
2902 !! result
2903 [[Otherplace, Somewhere|Otherplace]]
2904 [[Otherplace (place), Elsewhere|Otherplace]]
2905 !! end
2906
2907 !! test
2908 pre-save transform: context links ("pipe trick") with comma and parens
2909 !! options
2910 pst title=[[Who, me? (context)]]
2911 !! input
2912 [[|Yes, you.]]
2913 [[Me, Myself, and I (1937 song)|]]
2914 !! result
2915 [[Yes, you. (context)|Yes, you.]]
2916 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
2917 !! end
2918
2919 !! test
2920 pre-save transform: context links ("pipe trick") with namespace
2921 !! options
2922 pst title=[[Ns:Somearticle]]
2923 !! input
2924 [[|Article]]
2925 !! result
2926 [[Ns:Article|Article]]
2927 !! end
2928
2929 !! test
2930 pre-save transform: context links ("pipe trick") with namespace and parens
2931 !! options
2932 pst title=[[Ns:Somearticle (context)]]
2933 !! input
2934 [[|Article]]
2935 !! result
2936 [[Ns:Article (context)|Article]]
2937 !! end
2938
2939 !! test
2940 pre-save transform: context links ("pipe trick") with namespace and comma
2941 !! options
2942 pst title=[[Ns:Somearticle, Context, Whatever]]
2943 !! input
2944 [[|Article]]
2945 !! result
2946 [[Ns:Article, Context, Whatever|Article]]
2947 !! end
2948
2949 !! test
2950 pre-save transform: context links ("pipe trick") with namespace, comma and parens
2951 !! options
2952 pst title=[[Ns:Somearticle, Context (context)]]
2953 !! input
2954 [[|Article]]
2955 !! result
2956 [[Ns:Article (context)|Article]]
2957 !! end
2958
2959 !! test
2960 pre-save transform: context links ("pipe trick") with namespace, parens and comma
2961 !! options
2962 pst title=[[Ns:Somearticle (IGNORED), Context]]
2963 !! input
2964 [[|Article]]
2965 !! result
2966 [[Ns:Article, Context|Article]]
2967 !! end
2968
2969
2970 ###
2971 ### Message transform tests
2972 ###
2973 !! test
2974 message transform: magic variables
2975 !! options
2976 msg
2977 !! input
2978 {{SITENAME}}
2979 !! result
2980 MediaWiki
2981 !! end
2982
2983 !! test
2984 message transform: should not transform wiki markup
2985 !! options
2986 msg
2987 !! input
2988 ''test''
2989 !! result
2990 ''test''
2991 !! end
2992
2993 !! test
2994 message transform: <noinclude> in transcluded template (bug 4926)
2995 !! options
2996 msg
2997 !! input
2998 {{Includes}}
2999 !! result
3000 Foobar
3001 !! end
3002
3003 !! test
3004 message transform: <onlyinclude> in transcluded template (bug 4926)
3005 !! options
3006 msg
3007 !! input
3008 {{Includes2}}
3009 !! result
3010 Foo
3011 !! end
3012
3013 !! test
3014 {{#special:}} page name, known
3015 !! options
3016 msg
3017 !! input
3018 {{#special:Recentchanges}}
3019 !! result
3020 Special:Recentchanges
3021 !! end
3022
3023 !! test
3024 {{#special:}} page name, unknown
3025 !! options
3026 msg
3027 !! input
3028 {{#special:foobarnonexistent}}
3029 !! result
3030 No such special page
3031 !! end
3032
3033 ###
3034 ### Images
3035 ###
3036 !! test
3037 Simple image
3038 !! input
3039 [[Image:foobar.jpg]]
3040 !! result
3041 <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>
3042 </p>
3043 !! end
3044
3045 !! test
3046 Right-aligned image
3047 !! input
3048 [[Image:foobar.jpg|right]]
3049 !! result
3050 <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>
3051
3052 !! end
3053
3054 !! test
3055 Image with caption
3056 !! input
3057 [[Image:foobar.jpg|right|Caption text]]
3058 !! result
3059 <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>
3060
3061 !! end
3062
3063 !! test
3064 Image with frame and link
3065 !! input
3066 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3067 !! result
3068 <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>
3069
3070 !! end
3071
3072 !! test
3073 Link to image page- image page normally doesn't exists, hence edit link
3074 Add test with existing image page
3075 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
3076 !! input
3077 [[:Image:test]]
3078 !! result
3079 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
3080 </p>
3081 !! end
3082
3083 !! test
3084 Frameless image caption with a free URL
3085 !! input
3086 [[Image:foobar.jpg|http://example.com]]
3087 !! result
3088 <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>
3089 </p>
3090 !! end
3091
3092 !! test
3093 Thumbnail image caption with a free URL
3094 !! input
3095 [[Image:foobar.jpg|thumb|http://example.com]]
3096 !! result
3097 <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>
3098
3099 !! end
3100
3101 !! test
3102 BUG 1887: A ISBN with a thumbnail
3103 !! input
3104 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3105 !! result
3106 <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>
3107
3108 !! end
3109
3110 !! test
3111 BUG 1887: A RFC with a thumbnail
3112 !! input
3113 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3114 !! result
3115 <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>
3116
3117 !! end
3118
3119 !! test
3120 BUG 1887: A mailto link with a thumbnail
3121 !! input
3122 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3123 !! result
3124 <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>
3125
3126 !! end
3127
3128 !! test
3129 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3130 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3131 !! input
3132 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3133 !! result
3134 <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>
3135
3136 !! end
3137
3138 !! test
3139 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3140 !! options
3141 math
3142 !! input
3143 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3144 !! result
3145 <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>
3146
3147 !! end
3148
3149 # Pending resolution to bug 368
3150 !! test
3151 BUG 648: Frameless image caption with a link
3152 !! input
3153 [[Image:foobar.jpg|text with a [[link]] in it]]
3154 !! result
3155 <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>
3156 </p>
3157 !! end
3158
3159 !! test
3160 BUG 648: Frameless image caption with a link (suffix)
3161 !! input
3162 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3163 !! result
3164 <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>
3165 </p>
3166 !! end
3167
3168 !! test
3169 BUG 648: Frameless image caption with an interwiki link
3170 !! input
3171 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3172 !! result
3173 <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>
3174 </p>
3175 !! end
3176
3177 !! test
3178 BUG 648: Frameless image caption with a piped interwiki link
3179 !! input
3180 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3181 !! result
3182 <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>
3183 </p>
3184 !! end
3185
3186 !! test
3187 Escape HTML special chars in image alt text
3188 !! input
3189 [[Image:foobar.jpg|& < > "]]
3190 !! result
3191 <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>
3192 </p>
3193 !! end
3194
3195 !! test
3196 BUG 499: Alt text should have &#1234;, not &amp;1234;
3197 !! input
3198 [[Image:foobar.jpg|&#9792;]]
3199 !! result
3200 <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>
3201 </p>
3202 !! end
3203
3204 !! test
3205 Broken image caption with link
3206 !! input
3207 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3208 !! result
3209 <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.
3210 </p>
3211 !! end
3212
3213 !! test
3214 Image caption containing another image
3215 !! input
3216 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3217 !! result
3218 <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>
3219
3220 !! end
3221
3222 !! test
3223 Image caption containing a newline
3224 !! input
3225 [[Image:Foobar.jpg|This
3226 *is some text]]
3227 !! result
3228 <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>
3229 </p>
3230 !!end
3231
3232
3233 !! test
3234 Bug 3090: External links other than http: in image captions
3235 !! input
3236 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3237 !! result
3238 <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>
3239
3240 !! end
3241
3242
3243 ###
3244 ### Subpages
3245 ###
3246 !! article
3247 Subpage test/subpage
3248 !! text
3249 foo
3250 !! endarticle
3251
3252 !! test
3253 Subpage link
3254 !! options
3255 subpage title=[[Subpage test]]
3256 !! input
3257 [[/subpage]]
3258 !! result
3259 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3260 </p>
3261 !! end
3262
3263 !! test
3264 Subpage noslash link
3265 !! options
3266 subpage title=[[Subpage test]]
3267 !!input
3268 [[/subpage/]]
3269 !! result
3270 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3271 </p>
3272 !! end
3273
3274 !! test
3275 Disabled subpages
3276 !! input
3277 [[/subpage]]
3278 !! result
3279 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
3280 </p>
3281 !! end
3282
3283 !! test
3284 BUG 561: {{/Subpage}}
3285 !! options
3286 subpage title=[[Page]]
3287 !! input
3288 {{/Subpage}}
3289 !! result
3290 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
3291 </p>
3292 !! end
3293
3294 ###
3295 ### Categories
3296 ###
3297 !! article
3298 Category:MediaWiki User's Guide
3299 !! text
3300 blah
3301 !! endarticle
3302
3303 !! test
3304 Link to category
3305 !! input
3306 [[:Category:MediaWiki User's Guide]]
3307 !! result
3308 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3309 </p>
3310 !! end
3311
3312 !! test
3313 Simple category
3314 !! options
3315 cat
3316 !! input
3317 [[Category:MediaWiki User's Guide]]
3318 !! result
3319 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3320 !! end
3321
3322 ###
3323 ### Inter-language links
3324 ###
3325 !! test
3326 Inter-language links
3327 !! options
3328 ill
3329 !! input
3330 [[es:Alimento]]
3331 [[fr:Nourriture]]
3332 [[zh:&#39135;&#21697;]]
3333 !! result
3334 es:Alimento fr:Nourriture zh:食品
3335 !! end
3336
3337 ###
3338 ### Sections
3339 ###
3340 !! test
3341 Basic section headings
3342 !! input
3343 == Headline 1 ==
3344 Some text
3345
3346 ==Headline 2==
3347 More
3348 ===Smaller headline===
3349 Blah blah
3350 !! result
3351 <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>
3352 <p>Some text
3353 </p>
3354 <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>
3355 <p>More
3356 </p>
3357 <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>
3358 <p>Blah blah
3359 </p>
3360 !! end
3361
3362 !! test
3363 Section headings with TOC
3364 !! input
3365 == Headline 1 ==
3366 === Subheadline 1 ===
3367 ===== Skipping a level =====
3368 ====== Skipping a level ======
3369
3370 == Headline 2 ==
3371 Some text
3372 ===Another headline===
3373 !! result
3374 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3375 <ul>
3376 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3377 <ul>
3378 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3379 <ul>
3380 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3381 <ul>
3382 <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>
3383 </ul>
3384 </li>
3385 </ul>
3386 </li>
3387 </ul>
3388 </li>
3389 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3390 <ul>
3391 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3392 </ul>
3393 </li>
3394 </ul>
3395 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3396 <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>
3397 <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>
3398 <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>
3399 <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>
3400 <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>
3401 <p>Some text
3402 </p>
3403 <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>
3404
3405 !! end
3406
3407 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3408 !! test
3409 Handling of sections up to level 6 and beyond
3410 !! input
3411 = Level 1 Heading=
3412 == Level 2 Heading==
3413 === Level 3 Heading===
3414 ==== Level 4 Heading====
3415 ===== Level 5 Heading=====
3416 ====== Level 6 Heading======
3417 ======= Level 7 Heading=======
3418 ======== Level 8 Heading========
3419 ========= Level 9 Heading=========
3420 ========== Level 10 Heading==========
3421 !! result
3422 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3423 <ul>
3424 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3425 <ul>
3426 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3427 <ul>
3428 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3429 <ul>
3430 <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>
3431 <ul>
3432 <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>
3433 <ul>
3434 <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>
3435 <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>
3436 <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>
3437 <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>
3438 <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>
3439 </ul>
3440 </li>
3441 </ul>
3442 </li>
3443 </ul>
3444 </li>
3445 </ul>
3446 </li>
3447 </ul>
3448 </li>
3449 </ul>
3450 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3451 <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>
3452 <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>
3453 <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>
3454 <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>
3455 <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>
3456 <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>
3457 <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>
3458 <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>
3459 <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>
3460 <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>
3461
3462 !! end
3463
3464 !! test
3465 TOC regression (bug 9764)
3466 !! input
3467 == title 1 ==
3468 === title 1.1 ===
3469 ==== title 1.1.1 ====
3470 === title 1.2 ===
3471 == title 2 ==
3472 === title 2.1 ===
3473 !! result
3474 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3475 <ul>
3476 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3477 <ul>
3478 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
3479 <ul>
3480 <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>
3481 </ul>
3482 </li>
3483 <li class="toclevel-2"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3484 </ul>
3485 </li>
3486 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3487 <ul>
3488 <li class="toclevel-2"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3489 </ul>
3490 </li>
3491 </ul>
3492 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3493 <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>
3494 <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>
3495 <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>
3496 <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>
3497 <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>
3498 <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>
3499
3500 !! end
3501
3502 !! test
3503 TOC with wgMaxTocLevel=3 (bug 6204)
3504 !! options
3505 wgMaxTocLevel=3
3506 !! input
3507 == title 1 ==
3508 === title 1.1 ===
3509 ==== title 1.1.1 ====
3510 === title 1.2 ===
3511 == title 2 ==
3512 === title 2.1 ===
3513 !! result
3514 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3515 <ul>
3516 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3517 <ul>
3518 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
3519 <li class="toclevel-2"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3520 </ul>
3521 </li>
3522 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3523 <ul>
3524 <li class="toclevel-2"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3525 </ul>
3526 </li>
3527 </ul>
3528 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3529 <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>
3530 <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>
3531 <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>
3532 <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>
3533 <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>
3534 <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>
3535
3536 !! end
3537
3538 !! test
3539 Resolving duplicate section names
3540 !! input
3541 == Foo bar ==
3542 == Foo bar ==
3543 !! result
3544 <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>
3545 <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>
3546
3547 !! end
3548
3549 !! article
3550 Template:sections
3551 !! text
3552 ===Section 1===
3553 ==Section 2==
3554 !! endarticle
3555
3556 !! test
3557 Template with sections, __NOTOC__
3558 !! input
3559 __NOTOC__
3560 ==Section 0==
3561 {{sections}}
3562 ==Section 4==
3563 !! result
3564 <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>
3565 <a name="Section_1"></a><h3><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 1</span></h3>
3566 <a name="Section_2"></a><h2><span class="editsection">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a>]</span> <span class="mw-headline">Section 2</span></h2>
3567 <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>
3568
3569 !! end
3570
3571 !! test
3572 __NOEDITSECTION__ keyword
3573 !! input
3574 __NOEDITSECTION__
3575 ==Section 1==
3576 ==Section 2==
3577 !! result
3578 <a name="Section_1"></a><h2> <span class="mw-headline">Section 1</span></h2>
3579 <a name="Section_2"></a><h2> <span class="mw-headline">Section 2</span></h2>
3580
3581 !! end
3582
3583 !! test
3584 Link inside a section heading
3585 !! input
3586 ==Section with a [[Main Page|link]] in it==
3587 !! result
3588 <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>
3589
3590 !! end
3591
3592
3593 !! test
3594 BUG 1219 URL next to image (good)
3595 !! input
3596 http://example.com [[Image:foobar.jpg]]
3597 !! result
3598 <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>
3599 </p>
3600 !!end
3601
3602 !! test
3603 BUG 1219 URL next to image (broken)
3604 !! input
3605 http://example.com[[Image:foobar.jpg]]
3606 !! result
3607 <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>
3608 </p>
3609 !!end
3610
3611 !! test
3612 Bug 1186 news: in the middle of text
3613 !! input
3614 http://en.wikinews.org/wiki/Wikinews:Workplace
3615 !! result
3616 <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>
3617 </p>
3618 !!end
3619
3620
3621 !! test
3622 Namespaced link must have a title
3623 !! input
3624 [[Project:]]
3625 !! result
3626 <p>[[Project:]]
3627 </p>
3628 !!end
3629
3630 !! test
3631 Namespaced link must have a title (bad fragment version)
3632 !! input
3633 [[Project:#fragment]]
3634 !! result
3635 <p>[[Project:#fragment]]
3636 </p>
3637 !!end
3638
3639
3640 !! test
3641 div with no attributes
3642 !! input
3643 <div>HTML rocks</div>
3644 !! result
3645 <div>HTML rocks</div>
3646
3647 !! end
3648
3649 !! test
3650 div with double-quoted attribute
3651 !! input
3652 <div id="rock">HTML rocks</div>
3653 !! result
3654 <div id="rock">HTML rocks</div>
3655
3656 !! end
3657
3658 !! test
3659 div with single-quoted attribute
3660 !! input
3661 <div id='rock'>HTML rocks</div>
3662 !! result
3663 <div id="rock">HTML rocks</div>
3664
3665 !! end
3666
3667 !! test
3668 div with unquoted attribute
3669 !! input
3670 <div id=rock>HTML rocks</div>
3671 !! result
3672 <div id="rock">HTML rocks</div>
3673
3674 !! end
3675
3676 !! test
3677 div with illegal double attributes
3678 !! input
3679 <div align="center" align="right">HTML rocks</div>
3680 !! result
3681 <div align="right">HTML rocks</div>
3682
3683 !!end
3684
3685 !! test
3686 HTML multiple attributes correction
3687 !! input
3688 <p class="error" class="awesome">Awesome!</p>
3689 !! result
3690 <p class="awesome">Awesome!</p>
3691
3692 !!end
3693
3694 !! test
3695 Table multiple attributes correction
3696 !! input
3697 {|
3698 !+ class="error" class="awesome"| status
3699 |}
3700 !! result
3701 <table>
3702 <tr>
3703 <th class="awesome"> status
3704 </th></tr></table>
3705
3706 !!end
3707
3708 !! test
3709 DIV IN UPPERCASE
3710 !! input
3711 <DIV ALIGN="center">HTML ROCKS</DIV>
3712 !! result
3713 <div align="center">HTML ROCKS</div>
3714
3715 !!end
3716
3717
3718 !! test
3719 text with amp in the middle of nowhere
3720 !! input
3721 Remember AT&T?
3722 !!result
3723 <p>Remember AT&amp;T?
3724 </p>
3725 !! end
3726
3727 !! test
3728 text with character entity: eacute
3729 !! input
3730 I always thought &eacute; was a cute letter.
3731 !! result
3732 <p>I always thought &eacute; was a cute letter.
3733 </p>
3734 !! end
3735
3736 !! test
3737 text with undefined character entity: xacute
3738 !! input
3739 I always thought &xacute; was a cute letter.
3740 !! result
3741 <p>I always thought &amp;xacute; was a cute letter.
3742 </p>
3743 !! end
3744
3745
3746 ###
3747 ### Media links
3748 ###
3749
3750 !! test
3751 Media link
3752 !! input
3753 [[Media:Foobar.jpg]]
3754 !! result
3755 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3756 </p>
3757 !! end
3758
3759 !! test
3760 Media link with text
3761 !! input
3762 [[Media:Foobar.jpg|A neat file to look at]]
3763 !! result
3764 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3765 </p>
3766 !! end
3767
3768 # FIXME: this is still bad HTML tag nesting
3769 !! test
3770 Media link with nasty text
3771 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3772 !! input
3773 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3774 !! result
3775 <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>
3776
3777 !! end
3778
3779 !! test
3780 Media link to nonexistent file (bug 1702)
3781 !! input
3782 [[Media:No such.jpg]]
3783 !! result
3784 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3785 </p>
3786 !! end
3787
3788 !! test
3789 Image link to nonexistent file (bug 1850 - good)
3790 !! input
3791 [[Image:No such.jpg]]
3792 !! result
3793 <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>
3794 </p>
3795 !! end
3796
3797 !! test
3798 :Image link to nonexistent file (bug 1850 - bad)
3799 !! input
3800 [[:Image:No such.jpg]]
3801 !! result
3802 <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>
3803 </p>
3804 !! end
3805
3806
3807
3808 !! test
3809 Character reference normalization in link text (bug 1938)
3810 !! input
3811 [[Main Page|this&that]]
3812 !! result
3813 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3814 </p>
3815 !!end
3816
3817 !! test
3818 Empty attribute crash test (bug 2067)
3819 !! input
3820 <font color="">foo</font>
3821 !! result
3822 <p><font color="">foo</font>
3823 </p>
3824 !! end
3825
3826 !! test
3827 Empty attribute crash test single-quotes (bug 2067)
3828 !! input
3829 <font color=''>foo</font>
3830 !! result
3831 <p><font color="">foo</font>
3832 </p>
3833 !! end
3834
3835 !! test
3836 Attribute test: equals, then nothing
3837 !! input
3838 <font color=>foo</font>
3839 !! result
3840 <p><font>foo</font>
3841 </p>
3842 !! end
3843
3844 !! test
3845 Attribute test: unquoted value
3846 !! input
3847 <font color=x>foo</font>
3848 !! result
3849 <p><font color="x">foo</font>
3850 </p>
3851 !! end
3852
3853 !! test
3854 Attribute test: unquoted but illegal value (hash)
3855 !! input
3856 <font color=#x>foo</font>
3857 !! result
3858 <p><font color="#x">foo</font>
3859 </p>
3860 !! end
3861
3862 !! test
3863 Attribute test: no value
3864 !! input
3865 <font color>foo</font>
3866 !! result
3867 <p><font color="color">foo</font>
3868 </p>
3869 !! end
3870
3871 !! test
3872 Bug 2095: link with three closing brackets
3873 !! input
3874 [[Main Page]]]
3875 !! result
3876 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3877 </p>
3878 !! end
3879
3880 !! test
3881 Bug 2095: link with pipe and three closing brackets
3882 !! input
3883 [[Main Page|link]]]
3884 !! result
3885 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3886 </p>
3887 !! end
3888
3889 !! test
3890 Bug 2095: link with pipe and three closing brackets, version 2
3891 !! input
3892 [[Main Page|[http://example.com/]]]
3893 !! result
3894 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3895 </p>
3896 !! end
3897
3898
3899 ###
3900 ### Safety
3901 ###
3902
3903 !! article
3904 Template:Dangerous attribute
3905 !! text
3906 " onmouseover="alert(document.cookie)
3907 !! endarticle
3908
3909 !! article
3910 Template:Dangerous style attribute
3911 !! text
3912 border-size: expression(alert(document.cookie))
3913 !! endarticle
3914
3915 !! article
3916 Template:Div style
3917 !! text
3918 <div style="float: right; {{{1}}}">Magic div</div>
3919 !! endarticle
3920
3921 !! test
3922 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3923 !! input
3924 <div title="{{test}}"></div>
3925 !! result
3926 <div title="This is a test template"></div>
3927
3928 !! end
3929
3930 !! test
3931 Bug 2304: HTML attribute safety (dangerous template; 2309)
3932 !! input
3933 <div title="{{dangerous attribute}}"></div>
3934 !! result
3935 <div title=""></div>
3936
3937 !! end
3938
3939 !! test
3940 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3941 !! input
3942 <div style="{{dangerous style attribute}}"></div>
3943 !! result
3944 <div></div>
3945
3946 !! end
3947
3948 !! test
3949 Bug 2304: HTML attribute safety (safe parameter; 2309)
3950 !! input
3951 {{div style|width: 200px}}
3952 !! result
3953 <div style="float: right; width: 200px">Magic div</div>
3954
3955 !! end
3956
3957 !! test
3958 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3959 !! input
3960 {{div style|width: expression(alert(document.cookie))}}
3961 !! result
3962 <div>Magic div</div>
3963
3964 !! end
3965
3966 !! test
3967 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3968 !! input
3969 {{div style|"><script>alert(document.cookie)</script>}}
3970 !! result
3971 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
3972
3973 !! end
3974
3975 !! test
3976 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3977 !! input
3978 {{div style|" ><script>alert(document.cookie)</script>}}
3979 !! result
3980 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
3981
3982 !! end
3983
3984 !! test
3985 Bug 2304: HTML attribute safety (link)
3986 !! input
3987 <div title="[[Main Page]]"></div>
3988 !! result
3989 <div title="&#91;&#91;Main Page]]"></div>
3990
3991 !! end
3992
3993 !! test
3994 Bug 2304: HTML attribute safety (italics)
3995 !! input
3996 <div title="''foobar''"></div>
3997 !! result
3998 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3999
4000 !! end
4001
4002 !! test
4003 Bug 2304: HTML attribute safety (bold)
4004 !! input
4005 <div title="'''foobar'''"></div>
4006 !! result
4007 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4008
4009 !! end
4010
4011
4012 !! test
4013 Bug 2304: HTML attribute safety (ISBN)
4014 !! input
4015 <div title="ISBN 1234567890"></div>
4016 !! result
4017 <div title="&#73;SBN 1234567890"></div>
4018
4019 !! end
4020
4021 !! test
4022 Bug 2304: HTML attribute safety (RFC)
4023 !! input
4024 <div title="RFC 1234"></div>
4025 !! result
4026 <div title="&#82;FC 1234"></div>
4027
4028 !! end
4029
4030 !! test
4031 Bug 2304: HTML attribute safety (PMID)
4032 !! input
4033 <div title="PMID 1234567890"></div>
4034 !! result
4035 <div title="&#80;MID 1234567890"></div>
4036
4037 !! end
4038
4039 !! test
4040 Bug 2304: HTML attribute safety (web link)
4041 !! input
4042 <div title="http://example.com/"></div>
4043 !! result
4044 <div title="http&#58;//example.com/"></div>
4045
4046 !! end
4047
4048 !! test
4049 Bug 2304: HTML attribute safety (named web link)
4050 !! input
4051 <div title="[http://example.com/ link]"></div>
4052 !! result
4053 <div title="&#91;http&#58;//example.com/ link]"></div>
4054
4055 !! end
4056
4057 !! test
4058 Bug 3244: HTML attribute safety (extension; safe)
4059 !! input
4060 <div style="<nowiki>background:blue</nowiki>"></div>
4061 !! result
4062 <div style="background:blue"></div>
4063
4064 !! end
4065
4066 !! test
4067 Bug 3244: HTML attribute safety (extension; unsafe)
4068 !! input
4069 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4070 !! result
4071 <div></div>
4072
4073 !! end
4074
4075 !! test
4076 Math section safety when disabled
4077 !! input
4078 <math><script>alert(document.cookies);</script></math>
4079 !! result
4080 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4081 </p>
4082 !! end
4083
4084 # More MSIE fun discovered by Tom Gilder
4085
4086 !! test
4087 MSIE CSS safety test: spurious slash
4088 !! input
4089 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4090 !! result
4091 <div>evil</div>
4092
4093 !! end
4094
4095 !! test
4096 MSIE CSS safety test: hex code
4097 !! input
4098 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4099 !! result
4100 <div>evil</div>
4101
4102 !! end
4103
4104 !! test
4105 MSIE CSS safety test: comment in url
4106 !! input
4107 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4108 !! result
4109 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4110
4111 !! end
4112
4113 !! test
4114 MSIE CSS safety test: comment in expression
4115 !! input
4116 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4117 !! result
4118 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4119
4120 !! end
4121
4122
4123 !! test
4124 Table attribute legitimate extension
4125 !! input
4126 {|
4127 !+ style="<nowiki>color:blue</nowiki>"| status
4128 |}
4129 !! result
4130 <table>
4131 <tr>
4132 <th style="color:blue"> status
4133 </th></tr></table>
4134
4135 !!end
4136
4137 !! test
4138 Table attribute safety
4139 !! input
4140 {|
4141 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4142 |}
4143 !! result
4144 <table>
4145 <tr>
4146 <th> status
4147 </th></tr></table>
4148
4149 !! end
4150
4151
4152 !! article
4153 Template:Identity
4154 !! text
4155 {{{1}}}
4156 !! endarticle
4157
4158 !! test
4159 Expansion of multi-line templates in attribute values (bug 6255)
4160 !! input
4161 <div style="background: {{identity|#00FF00}}">-</div>
4162 !! result
4163 <div style="background: #00FF00">-</div>
4164
4165 !! end
4166
4167
4168 !! test
4169 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4170 !! input
4171 <div style="background:
4172 #00FF00">-</div>
4173 !! result
4174 <div style="background: #00FF00">-</div>
4175
4176 !! end
4177
4178 !! test
4179 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4180 !! input
4181 <div style="background: &#10;#00FF00">-</div>
4182 !! result
4183 <div style="background: &#10;#00FF00">-</div>
4184
4185 !! end
4186
4187 ###
4188 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4189 ###
4190 !! test
4191 Parser hook: empty input
4192 !! input
4193 <tag></tag>
4194 !! result
4195 <pre>
4196 string(0) ""
4197 array(0) {
4198 }
4199 </pre>
4200
4201 !! end
4202
4203 !! test
4204 Parser hook: empty input using terminated empty elements
4205 !! input
4206 <tag/>
4207 !! result
4208 <pre>
4209 NULL
4210 array(0) {
4211 }
4212 </pre>
4213
4214 !! end
4215
4216 !! test
4217 Parser hook: empty input using terminated empty elements (space before)
4218 !! input
4219 <tag />
4220 !! result
4221 <pre>
4222 NULL
4223 array(0) {
4224 }
4225 </pre>
4226
4227 !! end
4228
4229 !! test
4230 Parser hook: basic input
4231 !! input
4232 <tag>input</tag>
4233 !! result
4234 <pre>
4235 string(5) "input"
4236 array(0) {
4237 }
4238 </pre>
4239
4240 !! end
4241
4242
4243 !! test
4244 Parser hook: case insensitive
4245 !! input
4246 <TAG>input</TAG>
4247 !! result
4248 <pre>
4249 string(5) "input"
4250 array(0) {
4251 }
4252 </pre>
4253
4254 !! end
4255
4256
4257 !! test
4258 Parser hook: case insensitive, redux
4259 !! input
4260 <TaG>input</TAg>
4261 !! result
4262 <pre>
4263 string(5) "input"
4264 array(0) {
4265 }
4266 </pre>
4267
4268 !! end
4269
4270 !! test
4271 Parser hook: nested tags
4272 !! options
4273 noxml
4274 !! input
4275 <tag><tag></tag></tag>
4276 !! result
4277 <pre>
4278 string(5) "<tag>"
4279 array(0) {
4280 }
4281 </pre>&lt;/tag&gt;
4282
4283 !! end
4284
4285 !! test
4286 Parser hook: basic arguments
4287 !! input
4288 <tag width=200 height = "100" depth = '50' square></tag>
4289 !! result
4290 <pre>
4291 string(0) ""
4292 array(4) {
4293 ["width"]=>
4294 string(3) "200"
4295 ["height"]=>
4296 string(3) "100"
4297 ["depth"]=>
4298 string(2) "50"
4299 ["square"]=>
4300 string(6) "square"
4301 }
4302 </pre>
4303
4304 !! end
4305
4306 !! test
4307 Parser hook: argument containing a forward slash (bug 5344)
4308 !! input
4309 <tag filename='/tmp/bla'></tag>
4310 !! result
4311 <pre>
4312 string(0) ""
4313 array(1) {
4314 ["filename"]=>
4315 string(8) "/tmp/bla"
4316 }
4317 </pre>
4318
4319 !! end
4320
4321 !! test
4322 Parser hook: empty input using terminated empty elements (bug 2374)
4323 !! input
4324 <tag foo=bar/>text
4325 !! result
4326 <pre>
4327 NULL
4328 array(1) {
4329 ["foo"]=>
4330 string(3) "bar"
4331 }
4332 </pre>text
4333
4334 !! end
4335
4336 # </tag> should be output literally since there is no matching tag that begins it
4337 !! test
4338 Parser hook: basic arguments using terminated empty elements (bug 2374)
4339 !! input
4340 <tag width=200 height = "100" depth = '50' square/>
4341 other stuff
4342 </tag>
4343 !! result
4344 <pre>
4345 NULL
4346 array(4) {
4347 ["width"]=>
4348 string(3) "200"
4349 ["height"]=>
4350 string(3) "100"
4351 ["depth"]=>
4352 string(2) "50"
4353 ["square"]=>
4354 string(6) "square"
4355 }
4356 </pre>
4357 <p>other stuff
4358 &lt;/tag&gt;
4359 </p>
4360 !! end
4361
4362 ###
4363 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4364 ###
4365
4366 !! test
4367 Parser hook: static parser hook not inside a comment
4368 !! input
4369 <statictag>hello, world</statictag>
4370 <statictag action=flush/>
4371 !! result
4372 <p>hello, world
4373 </p>
4374 !! end
4375
4376
4377 !! test
4378 Parser hook: static parser hook inside a comment
4379 !! input
4380 <!-- <statictag>hello, world</statictag> -->
4381 <statictag action=flush/>
4382 !! result
4383 <p><br />
4384 </p>
4385 !! end
4386
4387 # Nested template calls; this case was broken by Parser.php rev 1.506,
4388 # since reverted.
4389
4390 !! article
4391 Template:One-parameter
4392 !! text
4393 (My parameter is: {{{1}}})
4394 !! endarticle
4395
4396 !! article
4397 Template:Map-one-parameter
4398 !! text
4399 {{{{{1}}}|{{{2}}}}}
4400 !! endarticle
4401
4402 !! test
4403 Nested template calls
4404 !! input
4405 {{Map-one-parameter|One-parameter|param}}
4406 !! result
4407 <p>(My parameter is: param)
4408 </p>
4409 !! end
4410
4411
4412 ###
4413 ### Sanitizer
4414 ###
4415 !! test
4416 Sanitizer: Closing of open tags
4417 !! input
4418 <s></s><table></table>
4419 !! result
4420 <s></s><table></table>
4421
4422 !! end
4423
4424 !! test
4425 Sanitizer: Closing of open but not closed tags
4426 !! input
4427 <s>foo
4428 !! result
4429 <p><s>foo</s>
4430 </p>
4431 !! end
4432
4433 !! test
4434 Sanitizer: Closing of closed but not open tags
4435 !! input
4436 </s>
4437 !! result
4438 <p>&lt;/s&gt;
4439 </p>
4440 !! end
4441
4442 !! test
4443 Sanitizer: Closing of closed but not open table tags
4444 !! input
4445 Table not started</td></tr></table>
4446 !! result
4447 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4448 </p>
4449 !! end
4450
4451 !! test
4452 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4453 !! input
4454 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4455 !! result
4456 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4457 </p>
4458 !! end
4459
4460 !! test
4461 Sanitizer: Validating the contents of the id attribute (bug 4515)
4462 !! options
4463 disabled
4464 !! input
4465 <br id=9 />
4466 !! result
4467 Something, but defenetly not <br id="9" />...
4468 !! end
4469
4470 !! test
4471 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4472 !! options
4473 disabled
4474 !! input
4475 <br id="foo" /><br id="foo" />
4476 !! result
4477 Something need to be done. foo-2 ?
4478 !! end
4479
4480 !! test
4481 Language converter: output gets cut off unexpectedly (bug 5757)
4482 !! options
4483 language=zh
4484 !! input
4485 this bit is safe: }-
4486
4487 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4488
4489 then we get cut off here: }-
4490
4491 all additional text is vanished
4492 !! result
4493 <p>this bit is safe: }-
4494 </p><p>but if we add a conversion instance: xxx
4495 </p><p>then we get cut off here: }-
4496 </p><p>all additional text is vanished
4497 </p>
4498 !! end
4499
4500 !! test
4501 Self closed html pairs (bug 5487)
4502 !! options
4503 !! input
4504 <center><font id="bug" />Centered text</center>
4505 <div><font id="bug2" />In div text</div>
4506 !! result
4507 <center>&lt;font id="bug" /&gt;Centered text</center>
4508 <div>&lt;font id="bug2" /&gt;In div text</div>
4509
4510 !! end
4511
4512 #
4513 #
4514 #
4515
4516 !! test
4517 HTML bullet list, closed tags (bug 5497)
4518 !! input
4519 <ul>
4520 <li>One</li>
4521 <li>Two</li>
4522 </ul>
4523 !! result
4524 <ul>
4525 <li>One</li>
4526 <li>Two</li>
4527 </ul>
4528
4529 !! end
4530
4531 !! test
4532 HTML bullet list, unclosed tags (bug 5497)
4533 !! input
4534 <ul>
4535 <li>One
4536 <li>Two
4537 </ul>
4538 !! result
4539 <ul>
4540 <li>One
4541 </li><li>Two
4542 </li></ul>
4543
4544 !! end
4545
4546 !! test
4547 HTML ordered list, closed tags (bug 5497)
4548 !! input
4549 <ol>
4550 <li>One</li>
4551 <li>Two</li>
4552 </ol>
4553 !! result
4554 <ol>
4555 <li>One</li>
4556 <li>Two</li>
4557 </ol>
4558
4559 !! end
4560
4561 !! test
4562 HTML ordered list, unclosed tags (bug 5497)
4563 !! input
4564 <ol>
4565 <li>One
4566 <li>Two
4567 </ol>
4568 !! result
4569 <ol>
4570 <li>One
4571 </li><li>Two
4572 </li></ol>
4573
4574 !! end
4575
4576 !! test
4577 HTML nested bullet list, closed tags (bug 5497)
4578 !! input
4579 <ul>
4580 <li>One</li>
4581 <li>Two:
4582 <ul>
4583 <li>Sub-one</li>
4584 <li>Sub-two</li>
4585 </ul>
4586 </li>
4587 </ul>
4588 !! result
4589 <ul>
4590 <li>One</li>
4591 <li>Two:
4592 <ul>
4593 <li>Sub-one</li>
4594 <li>Sub-two</li>
4595 </ul>
4596 </li>
4597 </ul>
4598
4599 !! end
4600
4601 !! test
4602 HTML nested bullet list, open tags (bug 5497)
4603 !! input
4604 <ul>
4605 <li>One
4606 <li>Two:
4607 <ul>
4608 <li>Sub-one
4609 <li>Sub-two
4610 </ul>
4611 </ul>
4612 !! result
4613 <ul>
4614 <li>One
4615 </li><li>Two:
4616 <ul>
4617 <li>Sub-one
4618 </li><li>Sub-two
4619 </li></ul>
4620 </li></ul>
4621
4622 !! end
4623
4624 !! test
4625 HTML nested ordered list, closed tags (bug 5497)
4626 !! input
4627 <ol>
4628 <li>One</li>
4629 <li>Two:
4630 <ol>
4631 <li>Sub-one</li>
4632 <li>Sub-two</li>
4633 </ol>
4634 </li>
4635 </ol>
4636 !! result
4637 <ol>
4638 <li>One</li>
4639 <li>Two:
4640 <ol>
4641 <li>Sub-one</li>
4642 <li>Sub-two</li>
4643 </ol>
4644 </li>
4645 </ol>
4646
4647 !! end
4648
4649 !! test
4650 HTML nested ordered list, open tags (bug 5497)
4651 !! input
4652 <ol>
4653 <li>One
4654 <li>Two:
4655 <ol>
4656 <li>Sub-one
4657 <li>Sub-two
4658 </ol>
4659 </ol>
4660 !! result
4661 <ol>
4662 <li>One
4663 </li><li>Two:
4664 <ol>
4665 <li>Sub-one
4666 </li><li>Sub-two
4667 </li></ol>
4668 </li></ol>
4669
4670 !! end
4671
4672 !! test
4673 HTML ordered list item with parameters oddity
4674 !! input
4675 <ol><li id="fragment">One</li></ol>
4676 !! result
4677 <ol><li id="fragment">One</li></ol>
4678
4679 !! end
4680
4681 !!test
4682 bug 5918: autonumbering
4683 !! input
4684 [http://first/] [http://second] [ftp://ftp]
4685
4686 ftp://inlineftp
4687
4688 [mailto:enclosed@mail.tld With target]
4689
4690 [mailto:enclosed@mail.tld]
4691
4692 mailto:inline@mail.tld
4693 !! result
4694 <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>
4695 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4696 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4697 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4698 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4699 </p>
4700 !! end
4701
4702
4703 #
4704 # Security and HTML correctness
4705 # From Nick Jenkins' fuzz testing
4706 #
4707
4708 !! test
4709 Fuzz testing: Parser13
4710 !! input
4711 {|
4712 | http://a|
4713 !! result
4714 <table>
4715 <tr>
4716 <td>
4717 </td>
4718 </tr>
4719 </table>
4720
4721 !! end
4722
4723 !! test
4724 Fuzz testing: Parser14
4725 !! input
4726 == onmouseover= ==
4727 http://__TOC__
4728 !! result
4729 <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>
4730 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4731 <ul>
4732 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4733 </ul>
4734 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4735
4736 !! end
4737
4738 !! test
4739 Fuzz testing: Parser14-table
4740 !! input
4741 ==a==
4742 {| STYLE=__TOC__
4743 !! result
4744 <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>
4745 <table style="&#95;_TOC&#95;_">
4746 <tr><td></td></tr>
4747 </table>
4748
4749 !! end
4750
4751 # Known to produce bogus xml (extra </td>)
4752 !! test
4753 Fuzz testing: Parser16
4754 !! options
4755 noxml
4756 !! input
4757 {|
4758 !https://||||||
4759 !! result
4760 <table>
4761 <tr>
4762 <th>https://</th><th></th><th></th><th>
4763 </td>
4764 </tr>
4765 </table>
4766
4767 !! end
4768
4769 !! test
4770 Fuzz testing: Parser21
4771 !! input
4772 {|
4773 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4774 |
4775 !! result
4776 <table>
4777 <tr>
4778 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4779 </th><td>
4780 </td>
4781 </tr>
4782 </table>
4783
4784 !! end
4785
4786 !! test
4787 Fuzz testing: Parser22
4788 !! input
4789 http://===r:::https://b
4790
4791 {|
4792 !!result
4793 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4794 </p>
4795 <table>
4796 <tr><td></td></tr>
4797 </table>
4798
4799 !! end
4800
4801 # Known to produce bad XML for now
4802 !! test
4803 Fuzz testing: Parser24
4804 !! options
4805 noxml
4806 !! input
4807 {|
4808 {{{|
4809 <u CLASS=
4810 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4811 <br style="onmouseover='alert(document.cookie);' " />
4812
4813 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4814 |
4815 !! result
4816 <table>
4817 {{{|
4818 <u class="&#124;">}}}} &gt;
4819 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
4820
4821 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4822 <tr>
4823 <td></u>
4824 </td>
4825 </tr>
4826 </table>
4827
4828 !! end
4829
4830 # Known to produce bad XML for now
4831 !!test
4832 Fuzz testing: Parser25 (bug 6055)
4833 !! options
4834 noxml
4835 !! input
4836 {{{
4837 |
4838 <LI CLASS=||
4839 >
4840 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4841 !! result
4842 <p>{{{|
4843 </p>
4844 <li class="&#124;&#124;">
4845 }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4846
4847 !! end
4848
4849 !!test
4850 Fuzz testing: URL adjacent extension (with space, clean)
4851 !! options
4852 !! input
4853 http://example.com <nowiki>junk</nowiki>
4854 !! result
4855 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
4856 </p>
4857 !!end
4858
4859 !!test
4860 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4861 !! options
4862 !! input
4863 http://example.com<nowiki>junk</nowiki>
4864 !! result
4865 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
4866 </p>
4867 !!end
4868
4869 !!test
4870 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4871 !! options
4872 !! input
4873 http://example.com<pre>junk</pre>
4874 !! result
4875 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4876
4877 !!end
4878
4879 !!test
4880 Fuzz testing: image with bogus manual thumbnail
4881 !!input
4882 [[Image:foobar.jpg|thumbnail= ]]
4883 !!result
4884 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
4885
4886 !!end
4887
4888 !! test
4889 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
4890 !! input
4891 <pre dir="&#10;"></pre>
4892 !! result
4893 <pre dir="&#10;"></pre>
4894
4895 !! end
4896
4897 !! test
4898 Parsing optional HTML elements (Bug 6171)
4899 !! options
4900 !! input
4901 <table>
4902 <tr>
4903 <td> Some tabular data</td>
4904 <td> More tabular data ...
4905 <td> And yet som tabular data</td>
4906 </tr>
4907 </table>
4908 !! result
4909 <table>
4910 <tr>
4911 <td> Some tabular data</td>
4912 <td> More tabular data ...
4913 </td><td> And yet som tabular data</td>
4914 </tr>
4915 </table>
4916
4917 !! end
4918
4919 !! test
4920 Correct handling of <td>, <tr> (Bug 6171)
4921 !! options
4922 !! input
4923 <table>
4924 <tr>
4925 <td> Some tabular data</td>
4926 <td> More tabular data ...</td>
4927 <td> And yet som tabular data</td>
4928 </tr>
4929 </table>
4930 !! result
4931 <table>
4932 <tr>
4933 <td> Some tabular data</td>
4934 <td> More tabular data ...</td>
4935 <td> And yet som tabular data</td>
4936 </tr>
4937 </table>
4938
4939 !! end
4940
4941
4942 !! test
4943 Parsing crashing regression (fr:JavaScript)
4944 !! input
4945 </body></x>
4946 !! result
4947 <p>&lt;/body&gt;&lt;/x&gt;
4948 </p>
4949 !! end
4950
4951 !! test
4952 Inline wiki vs wiki block nesting
4953 !! input
4954 '''Bold paragraph
4955
4956 New wiki paragraph
4957 !! result
4958 <p><b>Bold paragraph</b>
4959 </p><p>New wiki paragraph
4960 </p>
4961 !! end
4962
4963 !! test
4964 Inline HTML vs wiki block nesting
4965 !! input
4966 <b>Bold paragraph
4967
4968 New wiki paragraph
4969 !! result
4970 <p><b>Bold paragraph</b>
4971 </p><p>New wiki paragraph
4972 </p>
4973 !! end
4974
4975
4976 !!test
4977 Mixing markup for italics and bold
4978 !! options
4979 !! input
4980 '''bold''''''bold''bolditalics'''''
4981 !! result
4982 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4983 </p>
4984 !! end
4985
4986
4987 !! article
4988 Xyzzyx
4989 !! text
4990 Article for special page transclusion test
4991 !! endarticle
4992
4993 !! test
4994 Special page transclusion
4995 !! options
4996 !! input
4997 {{Special:Prefixindex/Xyzzyx}}
4998 !! result
4999 <p><br />
5000 </p>
5001 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5002
5003 !! end
5004
5005 !! test
5006 Special page transclusion twice (bug 5021)
5007 !! options
5008 !! input
5009 {{Special:Prefixindex/Xyzzyx}}
5010 {{Special:Prefixindex/Xyzzyx}}
5011 !! result
5012 <p><br />
5013 </p>
5014 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5015 <p><br />
5016 </p>
5017 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5018
5019 !! end
5020
5021 !! test
5022 Transclusion of default MediaWiki message
5023 !! input
5024 {{MediaWiki:Mainpage}}
5025 !!result
5026 <p>Main Page
5027 </p>
5028 !! end
5029
5030 !! test
5031 Transclusion of nonexistent MediaWiki message
5032 !! input
5033 {{MediaWiki:Mainpagexxx}}
5034 !!result
5035 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit" class="new" title="MediaWiki:Mainpagexxx">MediaWiki:Mainpagexxx</a>
5036 </p>
5037 !! end
5038
5039 !! test
5040 Transclusion of MediaWiki message with underscore
5041 !! input
5042 {{MediaWiki:history_short}}
5043 !! result
5044 <p>History
5045 </p>
5046 !! end
5047
5048 !! test
5049 Transclusion of MediaWiki message with space
5050 !! input
5051 {{MediaWiki:history short}}
5052 !! result
5053 <p>History
5054 </p>
5055 !! end
5056
5057 !! test
5058 Invalid header with following text
5059 !! input
5060 = x = y
5061 !! result
5062 <p>= x = y
5063 </p>
5064 !! end
5065
5066
5067 !! test
5068 Section extraction test (section 0)
5069 !! options
5070 section=0
5071 !! input
5072 start
5073 ==a==
5074 ===aa===
5075 ====aaa====
5076 ==b==
5077 ===ba===
5078 ===bb===
5079 ====bba====
5080 ===bc===
5081 ==c==
5082 ===ca===
5083 !! result
5084 start
5085 !! end
5086
5087 !! test
5088 Section extraction test (section 1)
5089 !! options
5090 section=1
5091 !! input
5092 start
5093 ==a==
5094 ===aa===
5095 ====aaa====
5096 ==b==
5097 ===ba===
5098 ===bb===
5099 ====bba====
5100 ===bc===
5101 ==c==
5102 ===ca===
5103 !! result
5104 ==a==
5105 ===aa===
5106 ====aaa====
5107 !! end
5108
5109 !! test
5110 Section extraction test (section 2)
5111 !! options
5112 section=2
5113 !! input
5114 start
5115 ==a==
5116 ===aa===
5117 ====aaa====
5118 ==b==
5119 ===ba===
5120 ===bb===
5121 ====bba====
5122 ===bc===
5123 ==c==
5124 ===ca===
5125 !! result
5126 ===aa===
5127 ====aaa====
5128 !! end
5129
5130 !! test
5131 Section extraction test (section 3)
5132 !! options
5133 section=3
5134 !! input
5135 start
5136 ==a==
5137 ===aa===
5138 ====aaa====
5139 ==b==
5140 ===ba===
5141 ===bb===
5142 ====bba====
5143 ===bc===
5144 ==c==
5145 ===ca===
5146 !! result
5147 ====aaa====
5148 !! end
5149
5150 !! test
5151 Section extraction test (section 4)
5152 !! options
5153 section=4
5154 !! input
5155 start
5156 ==a==
5157 ===aa===
5158 ====aaa====
5159 ==b==
5160 ===ba===
5161 ===bb===
5162 ====bba====
5163 ===bc===
5164 ==c==
5165 ===ca===
5166 !! result
5167 ==b==
5168 ===ba===
5169 ===bb===
5170 ====bba====
5171 ===bc===
5172 !! end
5173
5174 !! test
5175 Section extraction test (section 5)
5176 !! options
5177 section=5
5178 !! input
5179 start
5180 ==a==
5181 ===aa===
5182 ====aaa====
5183 ==b==
5184 ===ba===
5185 ===bb===
5186 ====bba====
5187 ===bc===
5188 ==c==
5189 ===ca===
5190 !! result
5191 ===ba===
5192 !! end
5193
5194 !! test
5195 Section extraction test (section 6)
5196 !! options
5197 section=6
5198 !! input
5199 start
5200 ==a==
5201 ===aa===
5202 ====aaa====
5203 ==b==
5204 ===ba===
5205 ===bb===
5206 ====bba====
5207 ===bc===
5208 ==c==
5209 ===ca===
5210 !! result
5211 ===bb===
5212 ====bba====
5213 !! end
5214
5215 !! test
5216 Section extraction test (section 7)
5217 !! options
5218 section=7
5219 !! input
5220 start
5221 ==a==
5222 ===aa===
5223 ====aaa====
5224 ==b==
5225 ===ba===
5226 ===bb===
5227 ====bba====
5228 ===bc===
5229 ==c==
5230 ===ca===
5231 !! result
5232 ====bba====
5233 !! end
5234
5235 !! test
5236 Section extraction test (section 8)
5237 !! options
5238 section=8
5239 !! input
5240 start
5241 ==a==
5242 ===aa===
5243 ====aaa====
5244 ==b==
5245 ===ba===
5246 ===bb===
5247 ====bba====
5248 ===bc===
5249 ==c==
5250 ===ca===
5251 !! result
5252 ===bc===
5253 !! end
5254
5255 !! test
5256 Section extraction test (section 9)
5257 !! options
5258 section=9
5259 !! input
5260 start
5261 ==a==
5262 ===aa===
5263 ====aaa====
5264 ==b==
5265 ===ba===
5266 ===bb===
5267 ====bba====
5268 ===bc===
5269 ==c==
5270 ===ca===
5271 !! result
5272 ==c==
5273 ===ca===
5274 !! end
5275
5276 !! test
5277 Section extraction test (section 10)
5278 !! options
5279 section=10
5280 !! input
5281 start
5282 ==a==
5283 ===aa===
5284 ====aaa====
5285 ==b==
5286 ===ba===
5287 ===bb===
5288 ====bba====
5289 ===bc===
5290 ==c==
5291 ===ca===
5292 !! result
5293 ===ca===
5294 !! end
5295
5296 !! test
5297 Section extraction test (nonexistent section 11)
5298 !! options
5299 section=11
5300 !! input
5301 start
5302 ==a==
5303 ===aa===
5304 ====aaa====
5305 ==b==
5306 ===ba===
5307 ===bb===
5308 ====bba====
5309 ===bc===
5310 ==c==
5311 ===ca===
5312 !! result
5313 !! end
5314
5315 !! test
5316 Section extraction test with bogus heading (section 1)
5317 !! options
5318 section=1
5319 !! input
5320 ==a==
5321 ==bogus== not a legal section
5322 ==b==
5323 !! result
5324 ==a==
5325 ==bogus== not a legal section
5326 !! end
5327
5328 !! test
5329 Section extraction test with bogus heading (section 2)
5330 !! options
5331 section=2
5332 !! input
5333 ==a==
5334 ==bogus== not a legal section
5335 ==b==
5336 !! result
5337 ==b==
5338 !! end
5339
5340 !! test
5341 Section extraction test with comment after heading (section 1)
5342 !! options
5343 section=1
5344 !! input
5345 ==a==
5346 ==unmarked== <!-- an unmarked section -->
5347 ==b==
5348 !! result
5349 ==a==
5350 ==unmarked== <!-- an unmarked section -->
5351 !! end
5352
5353 !! test
5354 Section extraction test with comment after heading (section 2)
5355 !! options
5356 section=2
5357 !! input
5358 ==a==
5359 ==unmarked== <!-- an unmarked section -->
5360 ==b==
5361 !! result
5362 ==b==
5363 !! end
5364
5365 !! test
5366 Section extraction test with bogus <nowiki> heading (section 1)
5367 !! options
5368 section=1
5369 !! input
5370 ==a==
5371 ==bogus== <nowiki>not a legal section</nowiki>
5372 ==b==
5373 !! result
5374 ==a==
5375 ==bogus== <nowiki>not a legal section</nowiki>
5376 !! end
5377
5378 !! test
5379 Section extraction test with bogus <nowiki> heading (section 2)
5380 !! options
5381 section=2
5382 !! input
5383 ==a==
5384 ==bogus== <nowiki>not a legal section</nowiki>
5385 ==b==
5386 !! result
5387 ==b==
5388 !! end
5389
5390
5391 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
5392 # instead of respecting commented sections
5393 !! test
5394 Section extraction prefixed by comment (section 1)
5395 !! options
5396 section=1
5397 !! input
5398 <!-- -->==sec1==
5399 ==sec2==
5400 !!result
5401 ==sec2==
5402 !!end
5403
5404 !! test
5405 Section extraction prefixed by comment (section 2)
5406 !! options
5407 section=2
5408 !! input
5409 <!-- -->==sec1==
5410 ==sec2==
5411 !!result
5412
5413 !!end
5414
5415
5416 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
5417 # instead of respecting HTML-style headings
5418 !! test
5419 Section extraction, mixed wiki and html (section 1)
5420 !! options
5421 section=1
5422 !! input
5423 <h2>unmarked</h2>
5424 unmarked
5425 ==1==
5426 one
5427 ==2==
5428 two
5429 !! result
5430 ==1==
5431 one
5432 !! end
5433
5434 !! test
5435 Section extraction, mixed wiki and html (section 2)
5436 !! options
5437 section=2
5438 !! input
5439 <h2>unmarked</h2>
5440 unmarked
5441 ==1==
5442 one
5443 ==2==
5444 two
5445 !! result
5446 ==2==
5447 two
5448 !! end
5449
5450
5451 # Formerly testing for bug 3342
5452 !! test
5453 Section extraction, heading surrounded by <noinclude>
5454 !! options
5455 section=1
5456 !! input
5457 <noinclude>==unmarked==</noinclude>
5458 ==marked==
5459 !! result
5460 ==marked==
5461 !!end
5462
5463
5464 !! test
5465 Section replacement test (section 0)
5466 !! options
5467 replace=0,"xxx"
5468 !! input
5469 start
5470 ==a==
5471 ===aa===
5472 ====aaa====
5473 ==b==
5474 ===ba===
5475 ===bb===
5476 ====bba====
5477 ===bc===
5478 ==c==
5479 ===ca===
5480 !! result
5481 xxx
5482
5483 ==a==
5484 ===aa===
5485 ====aaa====
5486 ==b==
5487 ===ba===
5488 ===bb===
5489 ====bba====
5490 ===bc===
5491 ==c==
5492 ===ca===
5493 !! end
5494
5495 !! test
5496 Section replacement test (section 1)
5497 !! options
5498 replace=1,"xxx"
5499 !! input
5500 start
5501 ==a==
5502 ===aa===
5503 ====aaa====
5504 ==b==
5505 ===ba===
5506 ===bb===
5507 ====bba====
5508 ===bc===
5509 ==c==
5510 ===ca===
5511 !! result
5512 start
5513 xxx
5514
5515 ==b==
5516 ===ba===
5517 ===bb===
5518 ====bba====
5519 ===bc===
5520 ==c==
5521 ===ca===
5522 !! end
5523
5524 !! test
5525 Section replacement test (section 2)
5526 !! options
5527 replace=2,"xxx"
5528 !! input
5529 start
5530 ==a==
5531 ===aa===
5532 ====aaa====
5533 ==b==
5534 ===ba===
5535 ===bb===
5536 ====bba====
5537 ===bc===
5538 ==c==
5539 ===ca===
5540 !! result
5541 start
5542 ==a==
5543 xxx
5544
5545 ==b==
5546 ===ba===
5547 ===bb===
5548 ====bba====
5549 ===bc===
5550 ==c==
5551 ===ca===
5552 !! end
5553
5554 !! test
5555 Section replacement test (section 3)
5556 !! options
5557 replace=3,"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 xxx
5575
5576 ==b==
5577 ===ba===
5578 ===bb===
5579 ====bba====
5580 ===bc===
5581 ==c==
5582 ===ca===
5583 !! end
5584
5585 !! test
5586 Section replacement test (section 4)
5587 !! options
5588 replace=4,"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 xxx
5607
5608 ==c==
5609 ===ca===
5610 !! end
5611
5612 !! test
5613 Section replacement test (section 5)
5614 !! options
5615 replace=5,"xxx"
5616 !! input
5617 start
5618 ==a==
5619 ===aa===
5620 ====aaa====
5621 ==b==
5622 ===ba===
5623 ===bb===
5624 ====bba====
5625 ===bc===
5626 ==c==
5627 ===ca===
5628 !! result
5629 start
5630 ==a==
5631 ===aa===
5632 ====aaa====
5633 ==b==
5634 xxx
5635
5636 ===bb===
5637 ====bba====
5638 ===bc===
5639 ==c==
5640 ===ca===
5641 !! end
5642
5643 !! test
5644 Section replacement test (section 6)
5645 !! options
5646 replace=6,"xxx"
5647 !! input
5648 start
5649 ==a==
5650 ===aa===
5651 ====aaa====
5652 ==b==
5653 ===ba===
5654 ===bb===
5655 ====bba====
5656 ===bc===
5657 ==c==
5658 ===ca===
5659 !! result
5660 start
5661 ==a==
5662 ===aa===
5663 ====aaa====
5664 ==b==
5665 ===ba===
5666 xxx
5667
5668 ===bc===
5669 ==c==
5670 ===ca===
5671 !! end
5672
5673 !! test
5674 Section replacement test (section 7)
5675 !! options
5676 replace=7,"xxx"
5677 !! input
5678 start
5679 ==a==
5680 ===aa===
5681 ====aaa====
5682 ==b==
5683 ===ba===
5684 ===bb===
5685 ====bba====
5686 ===bc===
5687 ==c==
5688 ===ca===
5689 !! result
5690 start
5691 ==a==
5692 ===aa===
5693 ====aaa====
5694 ==b==
5695 ===ba===
5696 ===bb===
5697 xxx
5698
5699 ===bc===
5700 ==c==
5701 ===ca===
5702 !! end
5703
5704 !! test
5705 Section replacement test (section 8)
5706 !! options
5707 replace=8,"xxx"
5708 !! input
5709 start
5710 ==a==
5711 ===aa===
5712 ====aaa====
5713 ==b==
5714 ===ba===
5715 ===bb===
5716 ====bba====
5717 ===bc===
5718 ==c==
5719 ===ca===
5720 !! result
5721 start
5722 ==a==
5723 ===aa===
5724 ====aaa====
5725 ==b==
5726 ===ba===
5727 ===bb===
5728 ====bba====
5729 xxx
5730
5731 ==c==
5732 ===ca===
5733 !!end
5734
5735 !! test
5736 Section replacement test (section 9)
5737 !! options
5738 replace=9,"xxx"
5739 !! input
5740 start
5741 ==a==
5742 ===aa===
5743 ====aaa====
5744 ==b==
5745 ===ba===
5746 ===bb===
5747 ====bba====
5748 ===bc===
5749 ==c==
5750 ===ca===
5751 !! result
5752 start
5753 ==a==
5754 ===aa===
5755 ====aaa====
5756 ==b==
5757 ===ba===
5758 ===bb===
5759 ====bba====
5760 ===bc===
5761 xxx
5762 !! end
5763
5764 !! test
5765 Section replacement test (section 10)
5766 !! options
5767 replace=10,"xxx"
5768 !! input
5769 start
5770 ==a==
5771 ===aa===
5772 ====aaa====
5773 ==b==
5774 ===ba===
5775 ===bb===
5776 ====bba====
5777 ===bc===
5778 ==c==
5779 ===ca===
5780 !! result
5781 start
5782 ==a==
5783 ===aa===
5784 ====aaa====
5785 ==b==
5786 ===ba===
5787 ===bb===
5788 ====bba====
5789 ===bc===
5790 ==c==
5791 xxx
5792 !! end
5793
5794
5795 !! test
5796 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5797 !! options
5798 section=1
5799 !! input
5800 ==a==
5801 a
5802 !! result
5803 ==a==
5804 a
5805 !! end
5806
5807 !! test
5808 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5809 !! options
5810 section=1
5811 !! input
5812 ==a==
5813 a
5814 !! result
5815 ==a==
5816 a
5817 !! end
5818
5819
5820 !! test
5821 Section extraction, <pre> around bogus header (bug 10309)
5822 !! options
5823 noxml section=2
5824 !! input
5825 == Section One ==
5826 <pre>
5827 =======
5828 </pre>
5829
5830 == Section Two ==
5831 stuff
5832 !! result
5833 == Section Two ==
5834 stuff
5835 !! end
5836
5837 !! test
5838 Section replacement, <pre> around bogus header (bug 10309)
5839 !! options
5840 noxml replace=2,"xxx"
5841 !! input
5842 == Section One ==
5843 <pre>
5844 =======
5845 </pre>
5846
5847 == Section Two ==
5848 stuff
5849 !! result
5850 == Section One ==
5851 <pre>
5852 =======
5853 </pre>
5854
5855 xxx
5856 !! end
5857
5858
5859
5860 !! test
5861 Handling of &#x0A; in URLs
5862 !! input
5863 **irc://&#x0A;a
5864 !! result
5865 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
5866 </li></ul>
5867 </li></ul>
5868
5869 !!end
5870
5871 !! test
5872 5 quotes, code coverage +1 line
5873 !! input
5874 '''''
5875 !! result
5876 !! end
5877
5878 !! test
5879 Special:Search page linking.
5880 !! input
5881 {{Special:search}}
5882 !! result
5883 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
5884 </p>
5885 !! end
5886
5887 !! test
5888 Say the magic word
5889 !! input
5890 * {{PAGENAME}}
5891 * {{BASEPAGENAME}}
5892 * {{SUBPAGENAME}}
5893 * {{SUBPAGENAMEE}}
5894 * {{BASEPAGENAME}}
5895 * {{BASEPAGENAMEE}}
5896 * {{TALKPAGENAME}}
5897 * {{TALKPAGENAMEE}}
5898 * {{SUBJECTPAGENAME}}
5899 * {{SUBJECTPAGENAMEE}}
5900 * {{NAMESPACEE}}
5901 * {{NAMESPACE}}
5902 * {{TALKSPACE}}
5903 * {{TALKSPACEE}}
5904 * {{SUBJECTSPACE}}
5905 * {{SUBJECTSPACEE}}
5906 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
5907 !! result
5908 <ul><li> Parser test
5909 </li><li> Parser test
5910 </li><li> Parser test
5911 </li><li> Parser_test
5912 </li><li> Parser test
5913 </li><li> Parser_test
5914 </li><li> Talk:Parser test
5915 </li><li> Talk:Parser_test
5916 </li><li> Parser test
5917 </li><li> Parser_test
5918 </li><li>
5919 </li><li>
5920 </li><li> Talk
5921 </li><li> Talk
5922 </li><li>
5923 </li><li>
5924 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit" class="new" title="Template:Dynamic">Template:Dynamic</a>
5925 </li></ul>
5926
5927 !! end
5928 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
5929
5930 !! test
5931 Gallery
5932 !! input
5933 <gallery>
5934 image1.png |
5935 image2.gif|||||
5936
5937 image3|
5938 image4 |300px| centre
5939 image5.svg| http://///////
5940 [[x|xx]]]]
5941 * image6
5942 </gallery>
5943 !! result
5944 <table class="gallery" cellspacing="0" cellpadding="0">
5945 <tr>
5946 <td><div class="gallerybox" style="width: 155px;">
5947 <div style="height: 152px;">Image1.png</div>
5948 <div class="gallerytext">
5949 </div>
5950 </div></td>
5951 <td><div class="gallerybox" style="width: 155px;">
5952 <div style="height: 152px;">Image2.gif</div>
5953 <div class="gallerytext">
5954 <p>||||
5955 </p>
5956 </div>
5957 </div></td>
5958 <td><div class="gallerybox" style="width: 155px;">
5959 <div style="height: 152px;">Image3</div>
5960 <div class="gallerytext">
5961 </div>
5962 </div></td>
5963 <td><div class="gallerybox" style="width: 155px;">
5964 <div style="height: 152px;">Image4</div>
5965 <div class="gallerytext">
5966 <p>300px| centre
5967 </p>
5968 </div>
5969 </div></td>
5970 </tr>
5971 <tr>
5972 <td><div class="gallerybox" style="width: 155px;">
5973 <div style="height: 152px;">Image5.svg</div>
5974 <div class="gallerytext">
5975 <pre><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
5976 </pre>
5977 </div>
5978 </div></td>
5979 <td><div class="gallerybox" style="width: 155px;">
5980 <div style="height: 152px;">* image6</div>
5981 <div class="gallerytext">
5982 </div>
5983 </div></td>
5984 </tr>
5985 </table>
5986
5987 !! end
5988
5989 !! test
5990 HTML Hex character encoding (spells the word "JavaScript")
5991 !! input
5992 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
5993 !! result
5994 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
5995 </p>
5996 !! end
5997
5998 !! test
5999 __FORCETOC__ override
6000 !! input
6001 __NEWSECTIONLINK__
6002 __FORCETOC__
6003 !! result
6004 <p><br />
6005 </p>
6006 !! end
6007
6008 !! test
6009 ISBN code coverage
6010 !! input
6011 ISBN 978-0-1234-56&#x20;789
6012 !! result
6013 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
6014 </p>
6015 !! end
6016
6017 !! test
6018 ISBN followed by 5 spaces
6019 !! input
6020 ISBN
6021 !! result
6022 <p>ISBN
6023 </p>
6024 !! end
6025
6026 !! test
6027 Double ISBN
6028 !! input
6029 ISBN ISBN 1234567890
6030 !! result
6031 <p>ISBN <a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
6032 </p>
6033 !! end
6034
6035 !! test
6036 Double RFC
6037 !! input
6038 RFC RFC 1234
6039 !! result
6040 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external" title="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
6041 </p>
6042 !! end
6043
6044 !! test
6045 Double RFC with a wiki link
6046 !! input
6047 RFC [[RFC 1234]]
6048 !! result
6049 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit" class="new" title="RFC 1234">RFC 1234</a>
6050 </p>
6051 !! end
6052
6053 !! test
6054 RFC code coverage
6055 !! input
6056 RFC 983&#x20;987
6057 !! result
6058 <p><a href="http://tools.ietf.org/html/rfc983" class="external" title="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
6059 </p>
6060 !! end
6061
6062 !! test
6063 Centre-aligned image
6064 !! input
6065 [[Image:foobar.jpg|centre]]
6066 !! result
6067 <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>
6068
6069 !!end
6070
6071 !! test
6072 None-aligned image
6073 !! input
6074 [[Image:foobar.jpg|none]]
6075 !! result
6076 <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>
6077
6078 !!end
6079
6080 !! test
6081 Width + Height sized image (using px) (height is ignored)
6082 !! input
6083 [[Image:foobar.jpg|640x480px]]
6084 !! result
6085 <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>
6086 </p>
6087 !!end
6088
6089 !! test
6090 Another italics / bold test
6091 !! input
6092 ''' ''x'
6093 !! result
6094 <pre>'<i> </i>x'
6095 </pre>
6096 !!end
6097
6098 # Note the results may be incorrect, as parserTest output included this:
6099 # XML error: Mismatched tag at byte 6120:
6100 # ...<dd> </dt></dl> </dd...
6101 !! test
6102 dt/dd/dl test
6103 !! input
6104 :;;;::
6105 !! result
6106 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6107 </dd></dl>
6108 </dd></dl>
6109 </dt></dl>
6110 </dt></dl>
6111 </dt></dl>
6112 </dd></dl>
6113
6114 !!end
6115
6116
6117 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6118 !! test
6119 Images with the "|" character in the comment
6120 !! input
6121 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6122 !! result
6123 <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>
6124
6125 !!end
6126
6127 !! test
6128 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6129 !! input
6130 <html><script>alert(1);</script></html>
6131 !! result
6132 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6133 </p>
6134 !! end
6135
6136 !! test
6137 HTML with raw HTML ($wgRawHtml==true)
6138 !! options
6139 rawhtml
6140 !! input
6141 <html><script>alert(1);</script></html>
6142 !! result
6143 <p><script>alert(1);</script>
6144 </p>
6145 !! end
6146
6147 !! test
6148 Parents of subpages, one level up
6149 !! options
6150 subpage title=[[Subpage test/L1/L2/L3]]
6151 !! input
6152 [[../|L2]]
6153 !! result
6154 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit" class="new" title="Subpage test/L1/L2">L2</a>
6155 </p>
6156 !! end
6157
6158
6159 !! test
6160 Parents of subpages, one level up, not named
6161 !! options
6162 subpage title=[[Subpage test/L1/L2/L3]]
6163 !! input
6164 [[../]]
6165 !! result
6166 <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>
6167 </p>
6168 !! end
6169
6170
6171
6172 !! test
6173 Parents of subpages, two levels up
6174 !! options
6175 disabled
6176 subpage title=[[Subpage test/L1/L2/L3]]
6177 !! input
6178 [[../../|L1]]2
6179 !! result
6180 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">L1</a>
6181 </p>
6182 !! end
6183
6184
6185 # Question: should result be "/index.php?title=Subpage_test/L1&amp;action=edit" instead?
6186 !! test
6187 Parents of subpages, two levels up, without trailing slash or name.
6188 !! options
6189 subpage title=[[Subpage test/L1/L2/L3]]
6190 !! input
6191 [[../..]]
6192 !! result
6193 <p><a href="/index.php?title=Subpage_test/L1/L2/..&amp;action=edit" class="new" title="Subpage test/L1">../..</a>
6194 </p>
6195 !! end
6196
6197 # Question: Why should the link text in the above test be "../..", yet in this test the "../.." part is silently dropped?
6198 # Current result: <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit" class="new" title="Subpage test/L1////">///
6199 !! test
6200 Parents of subpages, two levels up, with lots of extra trailing slashes.
6201 !! options
6202 subpage title=[[Subpage test/L1/L2/L3]]
6203 !! input
6204 [[../../////]]
6205 !! result
6206 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">Subpage test/L1</a>
6207 </p>
6208 !! end
6209
6210 !! test
6211 Definition list code coverage
6212 !! input
6213 ; title : def
6214 ; title : def
6215 ;title: def
6216 !! result
6217 <dl><dt> title &nbsp;</dt><dd> def
6218 </dd><dt> title&nbsp;</dt><dd> def
6219 </dd><dt>title</dt><dd> def
6220 </dd></dl>
6221
6222 !! end
6223
6224 !! test
6225 Don't fall for the self-closing div
6226 !! input
6227 <div>hello world</div/>
6228 !! result
6229 <div>hello world</div>
6230
6231 !! end
6232
6233 !! test
6234 MSGNW magic word
6235 !! input
6236 {{MSGNW:msg}}
6237 !! result
6238 <p>&#91;&#91;:Template:Msg&#93;&#93;
6239 </p>
6240 !! end
6241
6242 !! test
6243 RAW magic word
6244 !! input
6245 {{RAW:QUERTY}}
6246 !! result
6247 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit" class="new" title="Template:QUERTY">Template:QUERTY</a>
6248 </p>
6249 !! end
6250
6251 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6252 !! test
6253 Always escape literal '>' in output, not just after '<'
6254 !! input
6255 ><>
6256 !! result
6257 <p>&gt;&lt;&gt;
6258 </p>
6259 !! end
6260
6261 !! test
6262 Template caching
6263 !! input
6264 {{Test}}
6265 {{Test}}
6266 !! result
6267 <p>This is a test template
6268 This is a test template
6269 </p>
6270 !! end
6271
6272
6273 !! article
6274 MediaWiki:Fake
6275 !! text
6276 ==header==
6277 !! endarticle
6278
6279 !! test
6280 Inclusion of !userCanEdit() content
6281 !! input
6282 {{MediaWiki:Fake}}
6283 !! result
6284 <a name="header"></a><h2><span class="editsection">[<a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline">header</span></h2>
6285
6286 !! end
6287
6288
6289 !! test
6290 Out-of-order TOC heading levels
6291 !! input
6292 ==2==
6293 ======6======
6294 ===3===
6295 =1=
6296 =====5=====
6297 ==2==
6298 !! result
6299 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6300 <ul>
6301 <li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6302 <ul>
6303 <li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6304 <li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6305 </ul>
6306 </li>
6307 <li class="toclevel-1"><a href="#1_7"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6308 <ul>
6309 <li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6310 <li class="toclevel-2"><a href="#2_4"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6311 </ul>
6312 </li>
6313 </ul>
6314 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6315 <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>
6316 <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>
6317 <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>
6318 <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>
6319 <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>
6320 <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>
6321
6322 !! end
6323
6324
6325 !! test
6326 ISBN with a dummy number
6327 !! input
6328 ISBN ---
6329 !! result
6330 <p>ISBN ---
6331 </p>
6332 !! end
6333
6334
6335 !! test
6336 ISBN with space-delimited number
6337 !! input
6338 ISBN 92 9017 032 8
6339 !! result
6340 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9290170328" class="internal">ISBN 92 9017 032 8</a>
6341 </p>
6342 !! end
6343
6344
6345 !! test
6346 ISBN with multiple spaces, no number
6347 !! input
6348 ISBN foo
6349 !! result
6350 <p>ISBN foo
6351 </p>
6352 !! end
6353
6354
6355 !! test
6356 ISBN length
6357 !! input
6358 ISBN 123456789
6359
6360 ISBN 1234567890
6361
6362 ISBN 12345678901
6363 !! result
6364 <p>ISBN 123456789
6365 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
6366 </p><p>ISBN 12345678901
6367 </p>
6368 !! end
6369
6370
6371 !! test
6372 ISBN with trailing year (bug 8110)
6373 !! input
6374 ISBN 1-234-56789-0 - 2006
6375
6376 ISBN 1 234 56789 0 - 2006
6377 !! result
6378 <p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6379 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6380 </p>
6381 !! end
6382
6383
6384 !! test
6385 Pages in namespace (Magic word disabled currently)
6386 !! input
6387 {{PAGESINNAMESPACE:}}
6388 !! result
6389
6390 !! end
6391
6392
6393 !! test
6394 anchorencode
6395 !! input
6396 {{anchorencode:foo bar©#%n}}
6397 !! result
6398 <p>foo_bar.C2.A9.23.25n
6399 </p>
6400 !! end
6401
6402
6403 !! test
6404 Bug 8293: Use of center tag ruins paragraph formatting
6405 !! input
6406 <center>
6407 foo
6408 </center>
6409
6410 bar
6411
6412 baz
6413 !! result
6414 <center>
6415 <p>foo
6416 </p>
6417 </center>
6418 <p>bar
6419 </p>
6420 <pre>baz
6421 </pre>
6422 !! end
6423
6424
6425 ###
6426 ### Language variants related tests
6427 ###
6428 !! test
6429 Self-link in language variants
6430 !! options
6431 title=[[Dunav]] language=sr
6432 !! input
6433 Both [[Dunav]] and [[Дунав]] are names for this river.
6434 !! result
6435 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6436 </p>
6437 !!end
6438
6439
6440 !! test
6441 Link to pages in language variants
6442 !! options
6443 language=sr
6444 !! input
6445 Main Page can be written as [[Маин Паге]]
6446 !! result
6447 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6448 </p>
6449 !!end
6450
6451
6452 !! test
6453 Multiple links to pages in language variants
6454 !! options
6455 language=sr
6456 !! input
6457 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6458 !! result
6459 <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>.
6460 </p>
6461 !!end
6462
6463
6464 !! test
6465 Simple template in language variants
6466 !! options
6467 language=sr
6468 !! input
6469 {{тест}}
6470 !! result
6471 <p>This is a test template
6472 </p>
6473 !! end
6474
6475
6476 !! test
6477 Template with explicit namespace in language variants
6478 !! options
6479 language=sr
6480 !! input
6481 {{Template:тест}}
6482 !! result
6483 <p>This is a test template
6484 </p>
6485 !! end
6486
6487
6488 !! test
6489 Basic test for template parameter in language variants
6490 !! options
6491 language=sr
6492 !! input
6493 {{парамтест|param=foo}}
6494 !! result
6495 <p>This is a test template with parameter foo
6496 </p>
6497 !! end
6498
6499
6500 !! test
6501 Simple category in language variants
6502 !! options
6503 language=sr cat
6504 !! input
6505 [[:Category:МедиаWики Усер'с Гуиде]]
6506 !! result
6507 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6508 !! end
6509
6510
6511 !! test
6512 Stripping -{}- tags (language variants)
6513 !! options
6514 language=sr
6515 !! input
6516 Latin proverb: -{Ne nuntium necare}-
6517 !! result
6518 <p>Latin proverb: Ne nuntium necare
6519 </p>
6520 !! end
6521
6522
6523 !! test
6524 Prevent conversion with -{}- tags (language variants)
6525 !! options
6526 language=sr variant=sr-ec
6527 !! input
6528 Latinski: -{Ne nuntium necare}-
6529 !! result
6530 <p>Латински: Ne nuntium necare
6531 </p>
6532 !! end
6533
6534
6535 !! test
6536 Prevent conversion of text with -{}- tags (language variants)
6537 !! options
6538 language=sr variant=sr-ec
6539 !! input
6540 Latinski: -{Ne nuntium necare}-
6541 !! result
6542 <p>Латински: Ne nuntium necare
6543 </p>
6544 !! end
6545
6546
6547 !! test
6548 Prevent conversion of links with -{}- tags (language variants)
6549 !! options
6550 language=sr variant=sr-ec
6551 !! input
6552 -{[[Main Page]]}-
6553 !! result
6554 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6555 </p>
6556 !! end
6557
6558
6559 !! test
6560 -{}- tags within headlines (within html for parserConvert())
6561 !! options
6562 language=sr variant=sr-ec
6563 !! input
6564 == -{Naslov}- ==
6565 !! result
6566 <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>
6567
6568 !! end
6569
6570
6571 !! test
6572 Explicit definition of language variant alternatives
6573 !! options
6574 language=zh variant=zh-tw
6575 !! input
6576 -{zh:China;zh-tw:Taiwan}-, not China
6577 !! result
6578 <p>Taiwan, not China
6579 </p>
6580 !! end
6581
6582
6583 !! test
6584 Adding explicit session-wise language variant mapping (A flag)
6585 !! options
6586 language=zh variant=zh-tw
6587 !! input
6588 -{A|zh:China;zh-tw:Taiwan}- is China
6589 !! result
6590 <p>Taiwan is Taiwan
6591 </p>
6592 !! end
6593
6594
6595 !! test
6596 Adding explicit conversion rule for title (T flag)
6597 !! options
6598 language=zh variant=zh-tw
6599 !! input
6600 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6601 !! result
6602 <p>Should be stripped!
6603 </p>
6604 !! end
6605
6606
6607 !! test
6608 Raw output of variant escape tags (R flag)
6609 !! options
6610 language=zh variant=zh-tw
6611 !! input
6612 Raw: -{R|zh:China;zh-tw:Taiwan}-
6613 !! result
6614 <p>Raw: zh:China;zh-tw:Taiwan
6615 </p>
6616 !! end
6617
6618
6619 !! test
6620 Do not convert roman numbers to language variants
6621 !! options
6622 language=sr variant=sr-ec
6623 !! input
6624 Fridrih IV je car.
6625 !! result
6626 <p>Фридрих IV је цар.
6627 </p>
6628 !! end
6629
6630 !!article
6631 Template:Bullet
6632 !!text
6633 * Bar
6634 !!endarticle
6635
6636 !! test
6637 Bug 529: Uncovered bullet
6638 !! input
6639 * Foo {{bullet}}
6640 !! result
6641 <ul><li> Foo
6642 </li><li> Bar
6643 </li></ul>
6644
6645 !! end
6646
6647 !! test
6648 Bug 529: Uncovered table already at line-start
6649 !! input
6650 x
6651
6652 {{table}}
6653 y
6654 !! result
6655 <p>x
6656 </p>
6657 <table>
6658 <tr>
6659 <td> 1 </td><td> 2
6660 </td></tr>
6661 <tr>
6662 <td> 3 </td><td> 4
6663 </td></tr></table>
6664 <p>y
6665 </p>
6666 !! end
6667
6668 !! test
6669 Bug 529: Uncovered bullet in parser function result
6670 !! input
6671 * Foo {{lc:{{bullet}} }}
6672 !! result
6673 <ul><li> Foo
6674 </li><li> bar
6675 </li></ul>
6676
6677 !! end
6678
6679
6680 #
6681 #
6682 #
6683
6684 TODO:
6685 more images
6686 more tables
6687 math
6688 character entities
6689 and much more
6690 Try for 100% code coverage