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