]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - maintenance/parserTests.txt
MediaWiki 1.15.5
[autoinstallsdev/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" style="/* insecure input */">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/pubmed/1234?dopt=Abstract" class="external" title="http://www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">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 style="/* insecure input */"></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 style="/* insecure input */">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 style="/* insecure input */"></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 style="/* insecure input */">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 style="/* insecure input */">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 style="/* insecure input */"> status
4356 </th></tr></table>
4357
4358 !! end
4359
4360 !! test
4361 CSS line continuation 1
4362 !! input
4363 <div style="background-image: u\&#10;rl(test.jpg);"></div>
4364 !! result
4365 <div style="/* insecure input */"></div>
4366
4367 !! end
4368
4369 !! test
4370 CSS line continuation 2
4371 !! input
4372 <div style="background-image: u\&#13;rl(test.jpg); "></div>
4373 !! result
4374 <div style="/* insecure input */"></div>
4375
4376 !! end
4377
4378 !! article
4379 Template:Identity
4380 !! text
4381 {{{1}}}
4382 !! endarticle
4383
4384 !! test
4385 Expansion of multi-line templates in attribute values (bug 6255)
4386 !! input
4387 <div style="background: {{identity|#00FF00}}">-</div>
4388 !! result
4389 <div style="background: #00FF00">-</div>
4390
4391 !! end
4392
4393
4394 !! test
4395 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4396 !! input
4397 <div style="background: 
4398 #00FF00">-</div>
4399 !! result
4400 <div style="background: #00FF00">-</div>
4401
4402 !! end
4403
4404 !! test
4405 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4406 !! input
4407 <div style="background: &#10;#00FF00">-</div>
4408 !! result
4409 <div style="background: &#10;#00FF00">-</div>
4410
4411 !! end
4412
4413 ###
4414 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4415 ###
4416 !! test
4417 Parser hook: empty input
4418 !! input
4419 <tag></tag>
4420 !! result
4421 <pre>
4422 string(0) ""
4423 array(0) {
4424 }
4425 </pre>
4426
4427 !! end
4428
4429 !! test
4430 Parser hook: empty input using terminated empty elements
4431 !! input
4432 <tag/>
4433 !! result
4434 <pre>
4435 NULL
4436 array(0) {
4437 }
4438 </pre>
4439
4440 !! end
4441
4442 !! test
4443 Parser hook: empty input using terminated empty elements (space before)
4444 !! input
4445 <tag />
4446 !! result
4447 <pre>
4448 NULL
4449 array(0) {
4450 }
4451 </pre>
4452
4453 !! end
4454
4455 !! test
4456 Parser hook: basic input
4457 !! input
4458 <tag>input</tag>
4459 !! result
4460 <pre>
4461 string(5) "input"
4462 array(0) {
4463 }
4464 </pre>
4465
4466 !! end
4467
4468
4469 !! test
4470 Parser hook: case insensitive
4471 !! input
4472 <TAG>input</TAG>
4473 !! result
4474 <pre>
4475 string(5) "input"
4476 array(0) {
4477 }
4478 </pre>
4479
4480 !! end
4481
4482
4483 !! test
4484 Parser hook: case insensitive, redux
4485 !! input
4486 <TaG>input</TAg>
4487 !! result
4488 <pre>
4489 string(5) "input"
4490 array(0) {
4491 }
4492 </pre>
4493
4494 !! end
4495
4496 !! test
4497 Parser hook: nested tags
4498 !! options
4499 noxml
4500 !! input
4501 <tag><tag></tag></tag>
4502 !! result
4503 <pre>
4504 string(5) "<tag>"
4505 array(0) {
4506 }
4507 </pre>&lt;/tag&gt;
4508
4509 !! end
4510
4511 !! test
4512 Parser hook: basic arguments
4513 !! input
4514 <tag width=200 height = "100" depth = '50' square></tag>
4515 !! result
4516 <pre>
4517 string(0) ""
4518 array(4) {
4519   ["width"]=>
4520   string(3) "200"
4521   ["height"]=>
4522   string(3) "100"
4523   ["depth"]=>
4524   string(2) "50"
4525   ["square"]=>
4526   string(6) "square"
4527 }
4528 </pre>
4529
4530 !! end
4531
4532 !! test
4533 Parser hook: argument containing a forward slash (bug 5344)
4534 !! input
4535 <tag filename='/tmp/bla'></tag>
4536 !! result
4537 <pre>
4538 string(0) ""
4539 array(1) {
4540   ["filename"]=>
4541   string(8) "/tmp/bla"
4542 }
4543 </pre>
4544
4545 !! end
4546
4547 !! test
4548 Parser hook: empty input using terminated empty elements (bug 2374)
4549 !! input
4550 <tag foo=bar/>text
4551 !! result
4552 <pre>
4553 NULL
4554 array(1) {
4555   ["foo"]=>
4556   string(3) "bar"
4557 }
4558 </pre>text
4559
4560 !! end
4561
4562 # </tag> should be output literally since there is no matching tag that begins it
4563 !! test
4564 Parser hook: basic arguments using terminated empty elements (bug 2374)
4565 !! input
4566 <tag width=200 height = "100" depth = '50' square/>
4567 other stuff
4568 </tag>
4569 !! result
4570 <pre>
4571 NULL
4572 array(4) {
4573   ["width"]=>
4574   string(3) "200"
4575   ["height"]=>
4576   string(3) "100"
4577   ["depth"]=>
4578   string(2) "50"
4579   ["square"]=>
4580   string(6) "square"
4581 }
4582 </pre>
4583 <p>other stuff
4584 &lt;/tag&gt;
4585 </p>
4586 !! end
4587
4588 ###
4589 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4590 ###
4591
4592 !! test
4593 Parser hook: static parser hook not inside a comment
4594 !! input
4595 <statictag>hello, world</statictag>
4596 <statictag action=flush/>
4597 !! result
4598 <p>hello, world
4599 </p>
4600 !! end
4601
4602
4603 !! test
4604 Parser hook: static parser hook inside a comment
4605 !! input
4606 <!-- <statictag>hello, world</statictag> -->
4607 <statictag action=flush/>
4608 !! result
4609 <p><br />
4610 </p>
4611 !! end
4612
4613 # Nested template calls; this case was broken by Parser.php rev 1.506,
4614 # since reverted.
4615
4616 !! article
4617 Template:One-parameter
4618 !! text
4619 (My parameter is: {{{1}}})
4620 !! endarticle
4621
4622 !! article
4623 Template:Map-one-parameter
4624 !! text
4625 {{{{{1}}}|{{{2}}}}}
4626 !! endarticle
4627
4628 !! test
4629 Nested template calls
4630 !! input
4631 {{Map-one-parameter|One-parameter|param}}
4632 !! result
4633 <p>(My parameter is: param)
4634 </p>
4635 !! end
4636
4637
4638 ###
4639 ### Sanitizer
4640 ###
4641 !! test
4642 Sanitizer: Closing of open tags
4643 !! input
4644 <s></s><table></table>
4645 !! result
4646 <s></s><table></table>
4647
4648 !! end
4649
4650 !! test
4651 Sanitizer: Closing of open but not closed tags
4652 !! input
4653 <s>foo
4654 !! result
4655 <p><s>foo</s>
4656 </p>
4657 !! end
4658
4659 !! test
4660 Sanitizer: Closing of closed but not open tags
4661 !! input
4662 </s>
4663 !! result
4664 <p>&lt;/s&gt;
4665 </p>
4666 !! end
4667
4668 !! test
4669 Sanitizer: Closing of closed but not open table tags
4670 !! input
4671 Table not started</td></tr></table>
4672 !! result
4673 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4674 </p>
4675 !! end
4676
4677 !! test
4678 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4679 !! input
4680 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4681 !! result
4682 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4683 </p>
4684 !! end
4685
4686 !! test
4687 Sanitizer: Validating the contents of the id attribute (bug 4515)
4688 !! options
4689 disabled
4690 !! input
4691 <br id=9 />
4692 !! result
4693 Something, but defenetly not <br id="9" />...
4694 !! end
4695
4696 !! test
4697 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4698 !! options
4699 disabled
4700 !! input
4701 <br id="foo" /><br id="foo" />
4702 !! result
4703 Something need to be done. foo-2 ? 
4704 !! end
4705
4706 !! test
4707 Language converter: output gets cut off unexpectedly (bug 5757)
4708 !! options
4709 language=zh
4710 !! input
4711 this bit is safe: }-
4712
4713 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4714
4715 then we get cut off here: }-
4716
4717 all additional text is vanished
4718 !! result
4719 <p>this bit is safe: }-
4720 </p><p>but if we add a conversion instance: xxx
4721 </p><p>then we get cut off here: }-
4722 </p><p>all additional text is vanished
4723 </p>
4724 !! end
4725
4726 !! test
4727 Self closed html pairs (bug 5487)
4728 !! options
4729 !! input
4730 <center><font id="bug" />Centered text</center>
4731 <div><font id="bug2" />In div text</div>
4732 !! result
4733 <center>&lt;font id="bug" /&gt;Centered text</center>
4734 <div>&lt;font id="bug2" /&gt;In div text</div>
4735
4736 !! end
4737
4738 #
4739 #
4740 #
4741
4742 !! test
4743 Punctuation: nbsp before exclamation
4744 !! input
4745 C'est grave !
4746 !! result
4747 <p>C'est grave&nbsp;!
4748 </p>
4749 !! end
4750
4751 !! test
4752 Punctuation: CSS !important (bug 11874)
4753 !! input
4754 <div style="width:50% !important">important</div>
4755 !! result
4756 <div style="width:50% !important">important</div>
4757
4758 !!end
4759
4760 !! test
4761 Punctuation: CSS ! important (bug 11874; with space after)
4762 !! input
4763 <div style="width:50% ! important">important</div>
4764 !! result
4765 <div style="width:50% ! important">important</div>
4766
4767 !!end
4768
4769
4770 !! test
4771 HTML bullet list, closed tags (bug 5497)
4772 !! input
4773 <ul>
4774 <li>One</li>
4775 <li>Two</li>
4776 </ul>
4777 !! result
4778 <ul>
4779 <li>One</li>
4780 <li>Two</li>
4781 </ul>
4782
4783 !! end
4784
4785 !! test
4786 HTML bullet list, unclosed tags (bug 5497)
4787 !! input
4788 <ul>
4789 <li>One
4790 <li>Two
4791 </ul>
4792 !! result
4793 <ul>
4794 <li>One
4795 </li><li>Two
4796 </li></ul>
4797
4798 !! end
4799
4800 !! test
4801 HTML ordered list, closed tags (bug 5497)
4802 !! input
4803 <ol>
4804 <li>One</li>
4805 <li>Two</li>
4806 </ol>
4807 !! result
4808 <ol>
4809 <li>One</li>
4810 <li>Two</li>
4811 </ol>
4812
4813 !! end
4814
4815 !! test
4816 HTML ordered list, unclosed tags (bug 5497)
4817 !! input
4818 <ol>
4819 <li>One
4820 <li>Two
4821 </ol>
4822 !! result
4823 <ol>
4824 <li>One
4825 </li><li>Two
4826 </li></ol>
4827
4828 !! end
4829
4830 !! test
4831 HTML nested bullet list, closed tags (bug 5497)
4832 !! input
4833 <ul>
4834 <li>One</li>
4835 <li>Two:
4836 <ul>
4837 <li>Sub-one</li>
4838 <li>Sub-two</li>
4839 </ul>
4840 </li>
4841 </ul>
4842 !! result
4843 <ul>
4844 <li>One</li>
4845 <li>Two:
4846 <ul>
4847 <li>Sub-one</li>
4848 <li>Sub-two</li>
4849 </ul>
4850 </li>
4851 </ul>
4852
4853 !! end
4854
4855 !! test
4856 HTML nested bullet list, open tags (bug 5497)
4857 !! input
4858 <ul>
4859 <li>One
4860 <li>Two:
4861 <ul>
4862 <li>Sub-one
4863 <li>Sub-two
4864 </ul>
4865 </ul>
4866 !! result
4867 <ul>
4868 <li>One
4869 </li><li>Two:
4870 <ul>
4871 <li>Sub-one
4872 </li><li>Sub-two
4873 </li></ul>
4874 </li></ul>
4875
4876 !! end
4877
4878 !! test
4879 HTML nested ordered list, closed tags (bug 5497)
4880 !! input
4881 <ol>
4882 <li>One</li>
4883 <li>Two:
4884 <ol>
4885 <li>Sub-one</li>
4886 <li>Sub-two</li>
4887 </ol>
4888 </li>
4889 </ol>
4890 !! result
4891 <ol>
4892 <li>One</li>
4893 <li>Two:
4894 <ol>
4895 <li>Sub-one</li>
4896 <li>Sub-two</li>
4897 </ol>
4898 </li>
4899 </ol>
4900
4901 !! end
4902
4903 !! test
4904 HTML nested ordered list, open tags (bug 5497)
4905 !! input
4906 <ol>
4907 <li>One
4908 <li>Two:
4909 <ol>
4910 <li>Sub-one
4911 <li>Sub-two
4912 </ol>
4913 </ol>
4914 !! result
4915 <ol>
4916 <li>One
4917 </li><li>Two:
4918 <ol>
4919 <li>Sub-one
4920 </li><li>Sub-two
4921 </li></ol>
4922 </li></ol>
4923
4924 !! end
4925
4926 !! test
4927 HTML ordered list item with parameters oddity
4928 !! input
4929 <ol><li id="fragment">One</li></ol>
4930 !! result
4931 <ol><li id="fragment">One</li></ol>
4932
4933 !! end
4934
4935 !!test
4936 bug 5918: autonumbering
4937 !! input
4938 [http://first/] [http://second] [ftp://ftp]
4939
4940 ftp://inlineftp
4941
4942 [mailto:enclosed@mail.tld With target]
4943
4944 [mailto:enclosed@mail.tld]
4945
4946 mailto:inline@mail.tld
4947 !! result
4948 <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>
4949 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4950 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4951 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4952 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4953 </p>
4954 !! end
4955
4956
4957 #
4958 # Security and HTML correctness
4959 # From Nick Jenkins' fuzz testing
4960 #
4961
4962 !! test
4963 Fuzz testing: Parser13
4964 !! input
4965 {| 
4966 | http://a|
4967 !! result
4968 <table>
4969 <tr>
4970 <td>
4971 </td>
4972 </tr>
4973 </table>
4974
4975 !! end
4976
4977 !! test
4978 Fuzz testing: Parser14
4979 !! input
4980 == onmouseover= ==
4981 http://__TOC__
4982 !! result
4983 <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>
4984 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4985 <ul>
4986 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4987 </ul>
4988 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4989
4990 !! end
4991
4992 !! test
4993 Fuzz testing: Parser14-table
4994 !! input
4995 ==a==
4996 {| STYLE=__TOC__
4997 !! result
4998 <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>
4999 <table style="&#95;_TOC&#95;_">
5000 <tr><td></td></tr>
5001 </table>
5002
5003 !! end
5004
5005 # Known to produce bogus xml (extra </td>)
5006 !! test
5007 Fuzz testing: Parser16
5008 !! options
5009 noxml
5010 !! input
5011 {|
5012 !https://||||||
5013 !! result
5014 <table>
5015 <tr>
5016 <th>https://</th><th></th><th></th><th>
5017 </td>
5018 </tr>
5019 </table>
5020
5021 !! end
5022
5023 !! test
5024 Fuzz testing: Parser21
5025 !! input
5026 {|
5027 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5028 |
5029 !! result
5030 <table>
5031 <tr>
5032 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
5033 </th><td>
5034 </td>
5035 </tr>
5036 </table>
5037
5038 !! end
5039
5040 !! test
5041 Fuzz testing: Parser22
5042 !! input
5043 http://===r:::https://b
5044
5045 {|
5046 !!result
5047 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
5048 </p>
5049 <table>
5050 <tr><td></td></tr>
5051 </table>
5052
5053 !! end
5054
5055 # Known to produce bad XML for now
5056 !! test
5057 Fuzz testing: Parser24
5058 !! options
5059 noxml
5060 !! input
5061 {|
5062 {{{|
5063 <u CLASS=
5064 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5065 <br style="onmouseover='alert(document.cookie);' " />
5066
5067 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5068 |
5069 !! result
5070 <table>
5071 {{{|
5072 <u class="&#124;">}}}} &gt;
5073 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5074
5075 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5076 <tr>
5077 <td></u>
5078 </td>
5079 </tr>
5080 </table>
5081
5082 !! end
5083
5084 # Note: the current result listed for this is not what the original one was,
5085 # but the original bug was JavaScript injection, which is fixed in any case.
5086 # It's not clear that the original result listed was any more correct than the
5087 # current one.  Original result:
5088 # <p>{{{| 
5089 # </p>
5090 # <li class="&#124;&#124;">
5091 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5092 !!test
5093 Fuzz testing: Parser25 (bug 6055)
5094 !! input
5095 {{{
5096
5097 <LI CLASS=||
5098  >
5099 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5100 !! result
5101 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5102 </p>
5103 !! end
5104
5105 !!test
5106 Fuzz testing: URL adjacent extension (with space, clean)
5107 !! options
5108 !! input
5109 http://example.com <nowiki>junk</nowiki>
5110 !! result
5111 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
5112 </p>
5113 !!end
5114
5115 !!test
5116 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5117 !! options
5118 !! input
5119 http://example.com<nowiki>junk</nowiki>
5120 !! result
5121 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
5122 </p>
5123 !!end
5124
5125 !!test
5126 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5127 !! options
5128 !! input
5129 http://example.com<pre>junk</pre>
5130 !! result
5131 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
5132
5133 !!end
5134
5135 !!test
5136 Fuzz testing: image with bogus manual thumbnail
5137 !!input
5138 [[Image:foobar.jpg|thumbnail= ]]
5139 !!result
5140 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail:   <div class="thumbcaption"></div></div></div>
5141
5142 !!end
5143
5144 !! test
5145 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5146 !! input
5147 <pre dir="&#10;"></pre>
5148 !! result
5149 <pre dir="&#10;"></pre>
5150
5151 !! end
5152
5153 !! test
5154 Parsing optional HTML elements (Bug 6171)
5155 !! options
5156 !! input
5157 <table>
5158   <tr>
5159     <td> Some tabular data</td>
5160     <td> More tabular data ...
5161     <td> And yet som tabular data</td>
5162   </tr>
5163 </table>
5164 !! result
5165 <table>
5166   <tr>
5167     <td> Some tabular data</td>
5168     <td> More tabular data ...
5169     </td><td> And yet som tabular data</td>
5170   </tr>
5171 </table>
5172
5173 !! end
5174
5175 !! test
5176 Correct handling of <td>, <tr> (Bug 6171)
5177 !! options
5178 !! input
5179 <table>
5180   <tr>
5181     <td> Some tabular data</td>
5182     <td> More tabular data ...</td>
5183     <td> And yet som tabular data</td>
5184   </tr>
5185 </table>
5186 !! result
5187 <table>
5188   <tr>
5189     <td> Some tabular data</td>
5190     <td> More tabular data ...</td>
5191     <td> And yet som tabular data</td>
5192   </tr>
5193 </table>
5194
5195 !! end
5196
5197
5198 !! test
5199 Parsing crashing regression (fr:JavaScript)
5200 !! input
5201 </body></x>
5202 !! result
5203 <p>&lt;/body&gt;&lt;/x&gt;
5204 </p>
5205 !! end
5206
5207 !! test
5208 Inline wiki vs wiki block nesting
5209 !! input
5210 '''Bold paragraph
5211
5212 New wiki paragraph
5213 !! result
5214 <p><b>Bold paragraph</b>
5215 </p><p>New wiki paragraph
5216 </p>
5217 !! end
5218
5219 !! test
5220 Inline HTML vs wiki block nesting
5221 !! input
5222 <b>Bold paragraph
5223
5224 New wiki paragraph
5225 !! result
5226 <p><b>Bold paragraph</b>
5227 </p><p>New wiki paragraph
5228 </p>
5229 !! end
5230
5231 # Original result was this:
5232 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5233 # </p>
5234 # While that might be marginally more intuitive, maybe, the six-apostrophe
5235 # construct is clearly pathological and the result stated here (which is what
5236 # the parser actually does) is about as reasonable as anything.
5237 !!test
5238 Mixing markup for italics and bold
5239 !! options
5240 !! input
5241 '''bold''''''bold''bolditalics'''''
5242 !! result
5243 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5244 </p>
5245 !! end
5246
5247
5248 !! article
5249 Xyzzyx
5250 !! text
5251 Article for special page transclusion test
5252 !! endarticle
5253
5254 !! test
5255 Special page transclusion
5256 !! options
5257 !! input
5258 {{Special:Prefixindex/Xyzzyx}}
5259 !! result
5260 <p><br />
5261 </p>
5262 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5263
5264 !! end
5265
5266 !! test
5267 Special page transclusion twice (bug 5021)
5268 !! options
5269 !! input
5270 {{Special:Prefixindex/Xyzzyx}}
5271 {{Special:Prefixindex/Xyzzyx}}
5272 !! result
5273 <p><br />
5274 </p>
5275 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5276 <p><br />
5277 </p>
5278 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5279
5280 !! end
5281
5282 !! test
5283 Transclusion of default MediaWiki message
5284 !! input
5285 {{MediaWiki:Mainpage}}
5286 !!result
5287 <p>Main Page
5288 </p>
5289 !! end
5290
5291 !! test
5292 Transclusion of nonexistent MediaWiki message
5293 !! input
5294 {{MediaWiki:Mainpagexxx}}
5295 !!result
5296 <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>
5297 </p>
5298 !! end
5299
5300 !! test
5301 Transclusion of MediaWiki message with underscore
5302 !! input
5303 {{MediaWiki:history_short}}
5304 !! result
5305 <p>History
5306 </p>
5307 !! end
5308
5309 !! test
5310 Transclusion of MediaWiki message with space
5311 !! input
5312 {{MediaWiki:history short}}
5313 !! result
5314 <p>History
5315 </p>
5316 !! end
5317
5318 !! test
5319 Invalid header with following text
5320 !! input
5321 = x = y
5322 !! result
5323 <p>= x = y
5324 </p>
5325 !! end
5326
5327
5328 !! test
5329 Section extraction test (section 0)
5330 !! options
5331 section=0
5332 !! input
5333 start
5334 ==a==
5335 ===aa===
5336 ====aaa====
5337 ==b==
5338 ===ba===
5339 ===bb===
5340 ====bba====
5341 ===bc===
5342 ==c==
5343 ===ca===
5344 !! result
5345 start
5346 !! end
5347
5348 !! test
5349 Section extraction test (section 1)
5350 !! options
5351 section=1
5352 !! input
5353 start
5354 ==a==
5355 ===aa===
5356 ====aaa====
5357 ==b==
5358 ===ba===
5359 ===bb===
5360 ====bba====
5361 ===bc===
5362 ==c==
5363 ===ca===
5364 !! result
5365 ==a==
5366 ===aa===
5367 ====aaa====
5368 !! end
5369
5370 !! test
5371 Section extraction test (section 2)
5372 !! options
5373 section=2
5374 !! input
5375 start
5376 ==a==
5377 ===aa===
5378 ====aaa====
5379 ==b==
5380 ===ba===
5381 ===bb===
5382 ====bba====
5383 ===bc===
5384 ==c==
5385 ===ca===
5386 !! result
5387 ===aa===
5388 ====aaa====
5389 !! end
5390
5391 !! test
5392 Section extraction test (section 3)
5393 !! options
5394 section=3
5395 !! input
5396 start
5397 ==a==
5398 ===aa===
5399 ====aaa====
5400 ==b==
5401 ===ba===
5402 ===bb===
5403 ====bba====
5404 ===bc===
5405 ==c==
5406 ===ca===
5407 !! result
5408 ====aaa====
5409 !! end
5410
5411 !! test
5412 Section extraction test (section 4)
5413 !! options
5414 section=4
5415 !! input
5416 start
5417 ==a==
5418 ===aa===
5419 ====aaa====
5420 ==b==
5421 ===ba===
5422 ===bb===
5423 ====bba====
5424 ===bc===
5425 ==c==
5426 ===ca===
5427 !! result
5428 ==b==
5429 ===ba===
5430 ===bb===
5431 ====bba====
5432 ===bc===
5433 !! end
5434
5435 !! test
5436 Section extraction test (section 5)
5437 !! options
5438 section=5
5439 !! input
5440 start
5441 ==a==
5442 ===aa===
5443 ====aaa====
5444 ==b==
5445 ===ba===
5446 ===bb===
5447 ====bba====
5448 ===bc===
5449 ==c==
5450 ===ca===
5451 !! result
5452 ===ba===
5453 !! end
5454
5455 !! test
5456 Section extraction test (section 6)
5457 !! options
5458 section=6
5459 !! input
5460 start
5461 ==a==
5462 ===aa===
5463 ====aaa====
5464 ==b==
5465 ===ba===
5466 ===bb===
5467 ====bba====
5468 ===bc===
5469 ==c==
5470 ===ca===
5471 !! result
5472 ===bb===
5473 ====bba====
5474 !! end
5475
5476 !! test
5477 Section extraction test (section 7)
5478 !! options
5479 section=7
5480 !! input
5481 start
5482 ==a==
5483 ===aa===
5484 ====aaa====
5485 ==b==
5486 ===ba===
5487 ===bb===
5488 ====bba====
5489 ===bc===
5490 ==c==
5491 ===ca===
5492 !! result
5493 ====bba====
5494 !! end
5495
5496 !! test
5497 Section extraction test (section 8)
5498 !! options
5499 section=8
5500 !! input
5501 start
5502 ==a==
5503 ===aa===
5504 ====aaa====
5505 ==b==
5506 ===ba===
5507 ===bb===
5508 ====bba====
5509 ===bc===
5510 ==c==
5511 ===ca===
5512 !! result
5513 ===bc===
5514 !! end
5515
5516 !! test
5517 Section extraction test (section 9)
5518 !! options
5519 section=9
5520 !! input
5521 start
5522 ==a==
5523 ===aa===
5524 ====aaa====
5525 ==b==
5526 ===ba===
5527 ===bb===
5528 ====bba====
5529 ===bc===
5530 ==c==
5531 ===ca===
5532 !! result
5533 ==c==
5534 ===ca===
5535 !! end
5536
5537 !! test
5538 Section extraction test (section 10)
5539 !! options
5540 section=10
5541 !! input
5542 start
5543 ==a==
5544 ===aa===
5545 ====aaa====
5546 ==b==
5547 ===ba===
5548 ===bb===
5549 ====bba====
5550 ===bc===
5551 ==c==
5552 ===ca===
5553 !! result
5554 ===ca===
5555 !! end
5556
5557 !! test
5558 Section extraction test (nonexistent section 11)
5559 !! options
5560 section=11
5561 !! input
5562 start
5563 ==a==
5564 ===aa===
5565 ====aaa====
5566 ==b==
5567 ===ba===
5568 ===bb===
5569 ====bba====
5570 ===bc===
5571 ==c==
5572 ===ca===
5573 !! result
5574 !! end
5575
5576 !! test
5577 Section extraction test with bogus heading (section 1)
5578 !! options
5579 section=1
5580 !! input
5581 ==a==
5582 ==bogus== not a legal section
5583 ==b==
5584 !! result
5585 ==a==
5586 ==bogus== not a legal section
5587 !! end
5588
5589 !! test
5590 Section extraction test with bogus heading (section 2)
5591 !! options
5592 section=2
5593 !! input
5594 ==a==
5595 ==bogus== not a legal section
5596 ==b==
5597 !! result
5598 ==b==
5599 !! end
5600
5601 !! test
5602 Section extraction test with comment after heading (section 1)
5603 !! options
5604 section=1
5605 !! input
5606 ==a==
5607 ==b== <!-- -->
5608 ==c==
5609 !! result
5610 ==a==
5611 !! end
5612
5613 !! test
5614 Section extraction test with comment after heading (section 2)
5615 !! options
5616 section=2
5617 !! input
5618 ==a==
5619 ==b== <!-- -->
5620 ==c==
5621 !! result
5622 ==b== <!-- -->
5623 !! end
5624
5625 !! test
5626 Section extraction test with bogus <nowiki> heading (section 1)
5627 !! options
5628 section=1
5629 !! input
5630 ==a==
5631 ==bogus== <nowiki>not a legal section</nowiki>
5632 ==b==
5633 !! result
5634 ==a==
5635 ==bogus== <nowiki>not a legal section</nowiki>
5636 !! end
5637
5638 !! test
5639 Section extraction test with bogus <nowiki> heading (section 2)
5640 !! options
5641 section=2
5642 !! input
5643 ==a==
5644 ==bogus== <nowiki>not a legal section</nowiki>
5645 ==b==
5646 !! result
5647 ==b==
5648 !! end
5649
5650
5651 # Formerly testing for bug 2587, now resolved by the use of unmarked sections 
5652 # instead of respecting commented sections
5653 !! test
5654 Section extraction prefixed by comment (section 1)
5655 !! options
5656 section=1
5657 !! input
5658 <!-- -->==sec1==
5659 ==sec2==
5660 !!result
5661 ==sec2==
5662 !!end
5663
5664 !! test
5665 Section extraction prefixed by comment (section 2)
5666 !! options
5667 section=2
5668 !! input
5669 <!-- -->==sec1==
5670 ==sec2==
5671 !!result
5672
5673 !!end
5674
5675
5676 # Formerly testing for bug 2607, now resolved by the use of unmarked sections 
5677 # instead of respecting HTML-style headings
5678 !! test
5679 Section extraction, mixed wiki and html (section 1)
5680 !! options
5681 section=1
5682 !! input
5683 <h2>unmarked</h2>
5684 unmarked
5685 ==1==
5686 one
5687 ==2==
5688 two
5689 !! result
5690 ==1==
5691 one
5692 !! end
5693
5694 !! test
5695 Section extraction, mixed wiki and html (section 2)
5696 !! options
5697 section=2
5698 !! input
5699 <h2>unmarked</h2>
5700 unmarked
5701 ==1==
5702 one
5703 ==2==
5704 two
5705 !! result
5706 ==2==
5707 two
5708 !! end
5709
5710
5711 # Formerly testing for bug 3342
5712 !! test
5713 Section extraction, heading surrounded by <noinclude>
5714 !! options
5715 section=1
5716 !! input
5717 <noinclude>==unmarked==</noinclude>
5718 ==marked==
5719 !! result
5720 ==marked==
5721 !!end
5722
5723
5724 !! test
5725 Section replacement test (section 0)
5726 !! options
5727 replace=0,"xxx"
5728 !! input
5729 start
5730 ==a==
5731 ===aa===
5732 ====aaa====
5733 ==b==
5734 ===ba===
5735 ===bb===
5736 ====bba====
5737 ===bc===
5738 ==c==
5739 ===ca===
5740 !! result
5741 xxx
5742
5743 ==a==
5744 ===aa===
5745 ====aaa====
5746 ==b==
5747 ===ba===
5748 ===bb===
5749 ====bba====
5750 ===bc===
5751 ==c==
5752 ===ca===
5753 !! end
5754
5755 !! test
5756 Section replacement test (section 1)
5757 !! options
5758 replace=1,"xxx"
5759 !! input
5760 start
5761 ==a==
5762 ===aa===
5763 ====aaa====
5764 ==b==
5765 ===ba===
5766 ===bb===
5767 ====bba====
5768 ===bc===
5769 ==c==
5770 ===ca===
5771 !! result
5772 start
5773 xxx
5774
5775 ==b==
5776 ===ba===
5777 ===bb===
5778 ====bba====
5779 ===bc===
5780 ==c==
5781 ===ca===
5782 !! end
5783
5784 !! test
5785 Section replacement test (section 2)
5786 !! options
5787 replace=2,"xxx"
5788 !! input
5789 start
5790 ==a==
5791 ===aa===
5792 ====aaa====
5793 ==b==
5794 ===ba===
5795 ===bb===
5796 ====bba====
5797 ===bc===
5798 ==c==
5799 ===ca===
5800 !! result
5801 start
5802 ==a==
5803 xxx
5804
5805 ==b==
5806 ===ba===
5807 ===bb===
5808 ====bba====
5809 ===bc===
5810 ==c==
5811 ===ca===
5812 !! end
5813
5814 !! test
5815 Section replacement test (section 3)
5816 !! options
5817 replace=3,"xxx"
5818 !! input
5819 start
5820 ==a==
5821 ===aa===
5822 ====aaa====
5823 ==b==
5824 ===ba===
5825 ===bb===
5826 ====bba====
5827 ===bc===
5828 ==c==
5829 ===ca===
5830 !! result
5831 start
5832 ==a==
5833 ===aa===
5834 xxx
5835
5836 ==b==
5837 ===ba===
5838 ===bb===
5839 ====bba====
5840 ===bc===
5841 ==c==
5842 ===ca===
5843 !! end
5844
5845 !! test
5846 Section replacement test (section 4)
5847 !! options
5848 replace=4,"xxx"
5849 !! input
5850 start
5851 ==a==
5852 ===aa===
5853 ====aaa====
5854 ==b==
5855 ===ba===
5856 ===bb===
5857 ====bba====
5858 ===bc===
5859 ==c==
5860 ===ca===
5861 !! result
5862 start
5863 ==a==
5864 ===aa===
5865 ====aaa====
5866 xxx
5867
5868 ==c==
5869 ===ca===
5870 !! end
5871
5872 !! test
5873 Section replacement test (section 5)
5874 !! options
5875 replace=5,"xxx"
5876 !! input
5877 start
5878 ==a==
5879 ===aa===
5880 ====aaa====
5881 ==b==
5882 ===ba===
5883 ===bb===
5884 ====bba====
5885 ===bc===
5886 ==c==
5887 ===ca===
5888 !! result
5889 start
5890 ==a==
5891 ===aa===
5892 ====aaa====
5893 ==b==
5894 xxx
5895
5896 ===bb===
5897 ====bba====
5898 ===bc===
5899 ==c==
5900 ===ca===
5901 !! end
5902
5903 !! test
5904 Section replacement test (section 6)
5905 !! options
5906 replace=6,"xxx"
5907 !! input
5908 start
5909 ==a==
5910 ===aa===
5911 ====aaa====
5912 ==b==
5913 ===ba===
5914 ===bb===
5915 ====bba====
5916 ===bc===
5917 ==c==
5918 ===ca===
5919 !! result
5920 start
5921 ==a==
5922 ===aa===
5923 ====aaa====
5924 ==b==
5925 ===ba===
5926 xxx
5927
5928 ===bc===
5929 ==c==
5930 ===ca===
5931 !! end
5932
5933 !! test
5934 Section replacement test (section 7)
5935 !! options
5936 replace=7,"xxx"
5937 !! input
5938 start
5939 ==a==
5940 ===aa===
5941 ====aaa====
5942 ==b==
5943 ===ba===
5944 ===bb===
5945 ====bba====
5946 ===bc===
5947 ==c==
5948 ===ca===
5949 !! result
5950 start
5951 ==a==
5952 ===aa===
5953 ====aaa====
5954 ==b==
5955 ===ba===
5956 ===bb===
5957 xxx
5958
5959 ===bc===
5960 ==c==
5961 ===ca===
5962 !! end
5963
5964 !! test
5965 Section replacement test (section 8)
5966 !! options
5967 replace=8,"xxx"
5968 !! input
5969 start
5970 ==a==
5971 ===aa===
5972 ====aaa====
5973 ==b==
5974 ===ba===
5975 ===bb===
5976 ====bba====
5977 ===bc===
5978 ==c==
5979 ===ca===
5980 !! result
5981 start
5982 ==a==
5983 ===aa===
5984 ====aaa====
5985 ==b==
5986 ===ba===
5987 ===bb===
5988 ====bba====
5989 xxx
5990
5991 ==c==
5992 ===ca===
5993 !!end
5994
5995 !! test
5996 Section replacement test (section 9)
5997 !! options
5998 replace=9,"xxx"
5999 !! input
6000 start
6001 ==a==
6002 ===aa===
6003 ====aaa====
6004 ==b==
6005 ===ba===
6006 ===bb===
6007 ====bba====
6008 ===bc===
6009 ==c==
6010 ===ca===
6011 !! result
6012 start
6013 ==a==
6014 ===aa===
6015 ====aaa====
6016 ==b==
6017 ===ba===
6018 ===bb===
6019 ====bba====
6020 ===bc===
6021 xxx
6022 !! end
6023
6024 !! test
6025 Section replacement test (section 10)
6026 !! options
6027 replace=10,"xxx"
6028 !! input
6029 start
6030 ==a==
6031 ===aa===
6032 ====aaa====
6033 ==b==
6034 ===ba===
6035 ===bb===
6036 ====bba====
6037 ===bc===
6038 ==c==
6039 ===ca===
6040 !! result
6041 start
6042 ==a==
6043 ===aa===
6044 ====aaa====
6045 ==b==
6046 ===ba===
6047 ===bb===
6048 ====bba====
6049 ===bc===
6050 ==c==
6051 xxx
6052 !! end
6053
6054 !! test
6055 Section replacement test with initial whitespace (bug 13728)
6056 !! options
6057 replace=2,"xxx"
6058 !! input
6059  Preformatted initial line
6060 ==a==
6061 ===a===
6062 !! result
6063  Preformatted initial line
6064 ==a==
6065 xxx
6066 !! end
6067
6068
6069 !! test
6070 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6071 !! options
6072 section=1
6073 !! input
6074 ==a==
6075                     a
6076 !! result
6077 ==a==
6078                     a
6079 !! end
6080
6081 !! test
6082 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6083 !! options
6084 section=1
6085 !! input
6086 ==a==
6087                    a
6088 !! result
6089 ==a==
6090                    a
6091 !! end
6092
6093
6094 !! test
6095 Section extraction, <pre> around bogus header (bug 10309)
6096 !! options
6097 noxml section=2
6098 !! input
6099 == Section One ==
6100 <pre>
6101 =======
6102 </pre>
6103
6104 == Section Two ==
6105 stuff
6106 !! result
6107 == Section Two ==
6108 stuff
6109 !! end
6110
6111 !! test
6112 Section replacement, <pre> around bogus header (bug 10309)
6113 !! options
6114 noxml replace=2,"xxx"
6115 !! input
6116 == Section One ==
6117 <pre>
6118 =======
6119 </pre>
6120
6121 == Section Two ==
6122 stuff
6123 !! result
6124 == Section One ==
6125 <pre>
6126 =======
6127 </pre>
6128
6129 xxx
6130 !! end
6131
6132
6133
6134 !! test
6135 Handling of &#x0A; in URLs
6136 !! input
6137 **irc://&#x0A;a
6138 !! result
6139 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
6140 </li></ul>
6141 </li></ul>
6142
6143 !!end
6144
6145 !! test
6146 5 quotes, code coverage +1 line
6147 !! input
6148 '''''
6149 !! result
6150 !! end
6151
6152 !! test
6153 Special:Search page linking.
6154 !! input
6155 {{Special:search}}
6156 !! result
6157 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6158 </p>
6159 !! end
6160
6161 !! test
6162 Say the magic word
6163 !! input
6164 * {{PAGENAME}}
6165 * {{BASEPAGENAME}}
6166 * {{SUBPAGENAME}}
6167 * {{SUBPAGENAMEE}}
6168 * {{BASEPAGENAME}}
6169 * {{BASEPAGENAMEE}}
6170 * {{TALKPAGENAME}}
6171 * {{TALKPAGENAMEE}}
6172 * {{SUBJECTPAGENAME}}
6173 * {{SUBJECTPAGENAMEE}}
6174 * {{NAMESPACEE}}
6175 * {{NAMESPACE}}
6176 * {{TALKSPACE}}
6177 * {{TALKSPACEE}}
6178 * {{SUBJECTSPACE}}
6179 * {{SUBJECTSPACEE}}
6180 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6181 !! result
6182 <ul><li> Parser test
6183 </li><li> Parser test
6184 </li><li> Parser test
6185 </li><li> Parser_test
6186 </li><li> Parser test
6187 </li><li> Parser_test
6188 </li><li> Talk:Parser test
6189 </li><li> Talk:Parser_test
6190 </li><li> Parser test
6191 </li><li> Parser_test
6192 </li><li> 
6193 </li><li> 
6194 </li><li> Talk
6195 </li><li> Talk
6196 </li><li> 
6197 </li><li> 
6198 </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>
6199 </li></ul>
6200
6201 !! end
6202 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6203
6204 !! test
6205 Gallery
6206 !! input
6207 <gallery>
6208 image1.png |
6209 image2.gif|||||
6210
6211 image3|
6212 image4    |300px| centre
6213  image5.svg| http://///////
6214 [[x|xx]]]]
6215 * image6
6216 </gallery>
6217 !! result
6218 <table class="gallery" cellspacing="0" cellpadding="0">
6219         <tr>
6220                 <td><div class="gallerybox" style="width: 155px;">
6221                         <div style="height: 152px;">Image1.png</div>
6222                         <div class="gallerytext">
6223                         </div>
6224                 </div></td>
6225                 <td><div class="gallerybox" style="width: 155px;">
6226                         <div style="height: 152px;">Image2.gif</div>
6227                         <div class="gallerytext">
6228 <p>||||
6229 </p>
6230                         </div>
6231                 </div></td>
6232                 <td><div class="gallerybox" style="width: 155px;">
6233                         <div style="height: 152px;">Image3</div>
6234                         <div class="gallerytext">
6235                         </div>
6236                 </div></td>
6237                 <td><div class="gallerybox" style="width: 155px;">
6238                         <div style="height: 152px;">Image4</div>
6239                         <div class="gallerytext">
6240 <p>300px| centre
6241 </p>
6242                         </div>
6243                 </div></td>
6244         </tr>
6245         <tr>
6246                 <td><div class="gallerybox" style="width: 155px;">
6247                         <div style="height: 152px;">Image5.svg</div>
6248                         <div class="gallerytext">
6249 <p><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
6250 </p>
6251                         </div>
6252                 </div></td>
6253                 <td><div class="gallerybox" style="width: 155px;">
6254                         <div style="height: 152px;">* image6</div>
6255                         <div class="gallerytext">
6256                         </div>
6257                 </div></td>
6258         </tr>
6259 </table>
6260
6261 !! end
6262
6263 !! test
6264 HTML Hex character encoding (spells the word "JavaScript")
6265 !! input
6266 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6267 !! result
6268 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6269 </p>
6270 !! end
6271
6272 !! test
6273 __FORCETOC__ override
6274 !! input 
6275 __NEWSECTIONLINK__
6276 __FORCETOC__
6277 !! result
6278 <p><br />
6279 </p>
6280 !! end
6281
6282 !! test
6283 ISBN code coverage
6284 !! input
6285 ISBN  978-0-1234-56&#x20;789
6286 !! result
6287 <p><a href="/wiki/Special:BookSources/9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
6288 </p>
6289 !! end
6290
6291 !! test
6292 ISBN followed by 5 spaces
6293 !! input
6294 ISBN    
6295 !! result
6296 <p>ISBN    
6297 </p>
6298 !! end
6299
6300 !! test
6301 Double ISBN
6302 !! input
6303 ISBN ISBN 1234567890
6304 !! result
6305 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6306 </p>
6307 !! end
6308
6309 !! test
6310 Double RFC
6311 !! input
6312 RFC RFC 1234
6313 !! result
6314 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external" title="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
6315 </p>
6316 !! end
6317
6318 !! test
6319 Double RFC with a wiki link 
6320 !! input
6321 RFC [[RFC 1234]]
6322 !! result
6323 <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>
6324 </p>
6325 !! end
6326
6327 !! test
6328 RFC code coverage
6329 !! input
6330 RFC   983&#x20;987
6331 !! result
6332 <p><a href="http://tools.ietf.org/html/rfc983" class="external" title="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
6333 </p>
6334 !! end
6335
6336 !! test
6337 Centre-aligned image
6338 !! input
6339 [[Image:foobar.jpg|centre]]
6340 !! result
6341 <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>
6342
6343 !!end
6344
6345 !! test
6346 None-aligned image
6347 !! input
6348 [[Image:foobar.jpg|none]]
6349 !! result
6350 <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>
6351
6352 !!end
6353
6354 !! test
6355 Width + Height sized image (using px) (height is ignored)
6356 !! input
6357 [[Image:foobar.jpg|640x480px]]
6358 !! result
6359 <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>
6360 </p>
6361 !!end
6362
6363 !! test
6364 Width-sized image (using px, no following whitespace)
6365 !! input
6366 [[Image:foobar.jpg|640px]]
6367 !! result
6368 <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>
6369 </p>
6370 !!end
6371
6372 !! test
6373 Width-sized image (using px, with following whitespace - test regression from r39467)
6374 !! input
6375 [[Image:foobar.jpg|640px ]]
6376 !! result
6377 <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>
6378 </p>
6379 !!end
6380
6381 !! test
6382 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6383 !! input
6384 [[Image:foobar.jpg| 640px]]
6385 !! result
6386 <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>
6387 </p>
6388 !!end
6389
6390 !! test
6391 Another italics / bold test
6392 !! input
6393  ''' ''x'
6394 !! result
6395 <pre>'<i> </i>x'
6396 </pre>
6397 !!end
6398
6399 # Note the results may be incorrect, as parserTest output included this:
6400 # XML error: Mismatched tag at byte 6120:
6401 # ...<dd> </dt></dl> </dd...
6402 !! test
6403 dt/dd/dl test
6404 !! input
6405 :;;;::
6406 !! result
6407 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6408 </dd></dl>
6409 </dd></dl>
6410 </dt></dl>
6411 </dt></dl>
6412 </dt></dl>
6413 </dd></dl>
6414
6415 !!end
6416
6417
6418 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6419 !! test
6420 Images with the "|" character in the comment
6421 !! input
6422 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6423 !! result
6424 <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>
6425
6426 !!end
6427
6428 !! test
6429 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6430 !! input
6431 <html><script>alert(1);</script></html>
6432 !! result
6433 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6434 </p>
6435 !! end
6436
6437 !! test
6438 HTML with raw HTML ($wgRawHtml==true)
6439 !! options
6440 rawhtml
6441 !! input
6442 <html><script>alert(1);</script></html>
6443 !! result
6444 <p><script>alert(1);</script>
6445 </p>
6446 !! end
6447
6448 !! test
6449 Parents of subpages, one level up
6450 !! options
6451 subpage title=[[Subpage test/L1/L2/L3]]
6452 !! input
6453 [[../|L2]]
6454 !! result
6455 <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>
6456 </p>
6457 !! end
6458
6459
6460 !! test
6461 Parents of subpages, one level up, not named
6462 !! options
6463 subpage title=[[Subpage test/L1/L2/L3]]
6464 !! input
6465 [[../]]
6466 !! result
6467 <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>
6468 </p>
6469 !! end
6470
6471
6472
6473 !! test
6474 Parents of subpages, two levels up
6475 !! options
6476 disabled
6477 subpage title=[[Subpage test/L1/L2/L3]]
6478 !! input
6479 [[../../|L1]]2
6480 !! result
6481 <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>
6482 </p>
6483 !! end
6484
6485 !! test
6486 Parents of subpages, two levels up, without trailing slash or name.
6487 !! options
6488 subpage title=[[Subpage test/L1/L2/L3]]
6489 !! input
6490 [[../..]]
6491 !! result
6492 <p>[[../..]]
6493 </p>
6494 !! end
6495
6496 !! test
6497 Parents of subpages, two levels up, with lots of extra trailing slashes.
6498 !! options
6499 subpage title=[[Subpage test/L1/L2/L3]]
6500 !! input
6501 [[../../////]]
6502 !! result
6503 <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>
6504 </p>
6505 !! end
6506
6507 !! test
6508 Definition list code coverage
6509 !! input
6510 ; title   : def
6511 ; title : def
6512 ;title: def
6513 !! result
6514 <dl><dt> title  &nbsp;</dt><dd> def
6515 </dd><dt> title&nbsp;</dt><dd> def
6516 </dd><dt>title</dt><dd> def
6517 </dd></dl>
6518
6519 !! end
6520
6521 !! test
6522 Don't fall for the self-closing div
6523 !! input
6524 <div>hello world</div/>
6525 !! result
6526 <div>hello world</div>
6527
6528 !! end
6529
6530 !! test
6531 MSGNW magic word
6532 !! input
6533 {{MSGNW:msg}}
6534 !! result
6535 <p>&#91;&#91;:Template:Msg&#93;&#93;
6536 </p>
6537 !! end
6538
6539 !! test
6540 RAW magic word
6541 !! input
6542 {{RAW:QUERTY}}
6543 !! result
6544 <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>
6545 </p>
6546 !! end
6547
6548 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6549 !! test
6550 Always escape literal '>' in output, not just after '<'
6551 !! input
6552 ><>
6553 !! result
6554 <p>&gt;&lt;&gt;
6555 </p>
6556 !! end
6557
6558 !! test
6559 Template caching
6560 !! input
6561 {{Test}}
6562 {{Test}}
6563 !! result
6564 <p>This is a test template
6565 This is a test template
6566 </p>
6567 !! end
6568
6569
6570 !! article
6571 MediaWiki:Fake
6572 !! text
6573 ==header==
6574 !! endarticle
6575
6576 !! test
6577 Inclusion of !userCanEdit() content
6578 !! input
6579 {{MediaWiki:Fake}}
6580 !! result
6581 <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>
6582
6583 !! end
6584
6585
6586 !! test
6587 Out-of-order TOC heading levels
6588 !! input
6589 ==2==
6590 ======6======
6591 ===3===
6592 =1=
6593 =====5=====
6594 ==2==
6595 !! result
6596 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6597 <ul>
6598 <li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6599 <ul>
6600 <li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6601 <li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6602 </ul>
6603 </li>
6604 <li class="toclevel-1"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6605 <ul>
6606 <li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6607 <li class="toclevel-2"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6608 </ul>
6609 </li>
6610 </ul>
6611 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6612 <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>
6613 <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>
6614 <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>
6615 <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>
6616 <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>
6617 <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>
6618
6619 !! end
6620
6621
6622 !! test
6623 ISBN with a dummy number
6624 !! input
6625 ISBN ---
6626 !! result
6627 <p>ISBN ---
6628 </p>
6629 !! end
6630
6631
6632 !! test
6633 ISBN with space-delimited number
6634 !! input
6635 ISBN 92 9017 032 8
6636 !! result
6637 <p><a href="/wiki/Special:BookSources/9290170328" class="internal">ISBN 92 9017 032 8</a>
6638 </p>
6639 !! end
6640
6641
6642 !! test
6643 ISBN with multiple spaces, no number
6644 !! input
6645 ISBN  foo
6646 !! result
6647 <p>ISBN  foo
6648 </p>
6649 !! end
6650
6651
6652 !! test
6653 ISBN length
6654 !! input
6655 ISBN 123456789
6656
6657 ISBN 1234567890
6658
6659 ISBN 12345678901
6660 !! result
6661 <p>ISBN 123456789
6662 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6663 </p><p>ISBN 12345678901
6664 </p>
6665 !! end
6666
6667
6668 !! test
6669 ISBN with trailing year (bug 8110)
6670 !! input
6671 ISBN 1-234-56789-0 - 2006
6672
6673 ISBN 1 234 56789 0 - 2006
6674 !! result
6675 <p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6676 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6677 </p>
6678 !! end
6679
6680
6681 !! test
6682 Pages in namespace (Magic word disabled currently)
6683 !! input
6684 {{PAGESINNAMESPACE:}}
6685 !! result
6686
6687 !! end
6688
6689
6690 !! test
6691 anchorencode
6692 !! input
6693 {{anchorencode:foo bar©#%n}}
6694 !! result
6695 <p>foo_bar.C2.A9.23.25n
6696 </p>
6697 !! end
6698
6699
6700 !! test
6701 Bug 8293: Use of center tag ruins paragraph formatting
6702 !! input
6703 <center>
6704 foo
6705 </center>
6706
6707 bar
6708
6709  baz
6710 !! result
6711 <center>
6712 <p>foo
6713 </p>
6714 </center>
6715 <p>bar
6716 </p>
6717 <pre>baz
6718 </pre>
6719 !! end
6720
6721
6722 ###
6723 ### Language variants related tests
6724 ###
6725 !! test
6726 Self-link in language variants
6727 !! options
6728 title=[[Dunav]] language=sr
6729 !! input
6730 Both [[Dunav]] and [[Дунав]] are names for this river.
6731 !! result
6732 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6733 </p>
6734 !!end
6735
6736
6737 !! test
6738 Link to pages in language variants
6739 !! options
6740 language=sr
6741 !! input
6742 Main Page can be written as [[Маин Паге]]
6743 !! result
6744 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6745 </p>
6746 !!end
6747
6748
6749 !! test
6750 Multiple links to pages in language variants
6751 !! options
6752 language=sr
6753 !! input
6754 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6755 !! result
6756 <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>.
6757 </p>
6758 !!end
6759
6760
6761 !! test
6762 Simple template in language variants
6763 !! options
6764 language=sr
6765 !! input
6766 {{тест}}
6767 !! result
6768 <p>This is a test template
6769 </p>
6770 !! end
6771
6772
6773 !! test
6774 Template with explicit namespace in language variants
6775 !! options
6776 language=sr
6777 !! input
6778 {{Template:тест}}
6779 !! result
6780 <p>This is a test template
6781 </p>
6782 !! end
6783
6784
6785 !! test
6786 Basic test for template parameter in language variants
6787 !! options
6788 language=sr
6789 !! input
6790 {{парамтест|param=foo}}
6791 !! result
6792 <p>This is a test template with parameter foo
6793 </p>
6794 !! end
6795
6796
6797 !! test
6798 Simple category in language variants
6799 !! options
6800 language=sr cat
6801 !! input
6802 [[:Category:МедиаWики Усер'с Гуиде]]
6803 !! result
6804 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#039;s Guide">MediaWiki User's Guide</a>
6805 !! end
6806
6807
6808 !! test
6809 Stripping -{}- tags (language variants)
6810 !! options
6811 language=sr
6812 !! input
6813 Latin proverb: -{Ne nuntium necare}-
6814 !! result
6815 <p>Latin proverb: Ne nuntium necare
6816 </p>
6817 !! end
6818
6819
6820 !! test
6821 Prevent conversion with -{}- tags (language variants)
6822 !! options
6823 language=sr variant=sr-ec
6824 !! input
6825 Latinski: -{Ne nuntium necare}-
6826 !! result
6827 <p>Латински: Ne nuntium necare
6828 </p>
6829 !! end
6830
6831
6832 !! test
6833 Prevent conversion of text with -{}- tags (language variants)
6834 !! options
6835 language=sr variant=sr-ec
6836 !! input
6837 Latinski: -{Ne nuntium necare}-
6838 !! result
6839 <p>Латински: Ne nuntium necare
6840 </p>
6841 !! end
6842
6843
6844 !! test
6845 Prevent conversion of links with -{}- tags (language variants)
6846 !! options
6847 language=sr variant=sr-ec
6848 !! input
6849 -{[[Main Page]]}-
6850 !! result
6851 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6852 </p>
6853 !! end
6854
6855
6856 !! test
6857 -{}- tags within headlines (within html for parserConvert())
6858 !! options
6859 language=sr variant=sr-ec
6860 !! input
6861 == -{Naslov}- ==
6862 !! result
6863 <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>
6864
6865 !! end
6866
6867
6868 !! test
6869 Explicit definition of language variant alternatives
6870 !! options
6871 language=zh variant=zh-tw
6872 !! input
6873 -{zh:China;zh-tw:Taiwan}-, not China
6874 !! result
6875 <p>Taiwan, not China
6876 </p>
6877 !! end
6878
6879
6880 !! test
6881 Adding explicit session-wise language variant mapping (A flag)
6882 !! options
6883 language=zh variant=zh-tw
6884 !! input
6885 -{A|zh:China;zh-tw:Taiwan}- is China
6886 !! result
6887 <p>Taiwan is Taiwan
6888 </p>
6889 !! end
6890
6891
6892 !! test
6893 Adding explicit conversion rule for title (T flag)
6894 !! options
6895 language=zh variant=zh-tw
6896 !! input
6897 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6898 !! result
6899 <p>Should be stripped!
6900 </p>
6901 !! end
6902
6903
6904 !! test
6905 Raw output of variant escape tags (R flag)
6906 !! options
6907 language=zh variant=zh-tw
6908 !! input
6909 Raw: -{R|zh:China;zh-tw:Taiwan}-
6910 !! result
6911 <p>Raw: zh:China;zh-tw:Taiwan
6912 </p>
6913 !! end
6914
6915
6916 !! test
6917 Do not convert roman numbers to language variants
6918 !! options
6919 language=sr variant=sr-ec
6920 !! input
6921 Fridrih IV je car.
6922 !! result
6923 <p>Фридрих IV је цар.
6924 </p>
6925 !! end
6926
6927 !!article 
6928 Template:Bullet
6929 !!text
6930 * Bar
6931 !!endarticle
6932
6933 !! test
6934 Bug 529: Uncovered bullet
6935 !! input
6936 * Foo {{bullet}}
6937 !! result
6938 <ul><li> Foo 
6939 </li><li> Bar
6940 </li></ul>
6941
6942 !! end
6943
6944 !! test
6945 Bug 529: Uncovered table already at line-start
6946 !! input
6947 x
6948
6949 {{table}}
6950 y
6951 !! result
6952 <p>x
6953 </p>
6954 <table>
6955 <tr>
6956 <td> 1 </td><td> 2
6957 </td></tr>
6958 <tr>
6959 <td> 3 </td><td> 4
6960 </td></tr></table>
6961 <p>y
6962 </p>
6963 !! end
6964
6965 !! test
6966 Bug 529: Uncovered bullet in parser function result
6967 !! input
6968 * Foo {{lc:{{bullet}} }}
6969 !! result
6970 <ul><li> Foo 
6971 </li><li> bar
6972 </li></ul>
6973
6974 !! end
6975
6976 !! test
6977 Bug 5678: Double-parsed template argument
6978 !! input
6979 {{lc:{{{1}}}|hello}}
6980 !! result
6981 <p>{{{1}}}
6982 </p>
6983 !! end
6984
6985 !! test
6986 Bug 5678: Double-parsed template invocation
6987 !! input
6988 {{lc:{{paramtest {{!}} param = hello }} }}
6989 !! result
6990 <p>{{paramtest | param = hello }}
6991 </p>
6992 !! end
6993
6994 !! test
6995 Morwen/13: Unclosed link followed by heading
6996 !! input
6997 [[link
6998 ==heading==
6999 !! result
7000 <p>[[link
7001 </p>
7002 <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>
7003
7004 !! end
7005
7006 !! test
7007 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7008 !! input
7009 {{foo|
7010 =heading=
7011 !! result
7012 <p>{{foo|
7013 </p>
7014 <a name="heading" id="heading"></a><h1> <span class="mw-headline">heading</span></h1>
7015
7016 !! end
7017
7018 !! test
7019 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7020 !! input
7021 {{foo|
7022 ==heading==
7023 !! result
7024 <p>{{foo|
7025 </p>
7026 <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>
7027
7028 !! end
7029
7030 !! test
7031 Tildes in comments
7032 !! options
7033 pst
7034 !! input
7035 <!-- ~~~~ -->
7036 !! result
7037 <!-- ~~~~ -->
7038 !! end
7039
7040 !! test
7041 Paragraphs inside divs (no extra line breaks)
7042 !! input
7043 <div>Line one
7044
7045 Line two</div>
7046 !! result
7047 <div>Line one
7048 Line two</div>
7049
7050 !! end
7051
7052 !! test
7053 Paragraphs inside divs (extra line break on open)
7054 !! input
7055 <div>
7056 Line one
7057
7058 Line two</div>
7059 !! result
7060 <div>
7061 <p>Line one
7062 </p>
7063 Line two</div>
7064
7065 !! end
7066
7067 !! test
7068 Paragraphs inside divs (extra line break on close)
7069 !! input
7070 <div>Line one
7071
7072 Line two
7073 </div>
7074 !! result
7075 <div>Line one
7076 <p>Line two
7077 </p>
7078 </div>
7079
7080 !! end
7081
7082 !! test
7083 Paragraphs inside divs (extra line break on open and close)
7084 !! input
7085 <div>
7086 Line one
7087
7088 Line two
7089 </div>
7090 !! result
7091 <div>
7092 <p>Line one
7093 </p><p>Line two
7094 </p>
7095 </div>
7096
7097 !! end
7098
7099 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7100 !! test
7101 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7102 !! input
7103 <blockquote>Line one
7104
7105 Line two</blockquote>
7106 !! result
7107 <blockquote>Line one
7108 Line two</blockquote>
7109
7110 !! end
7111
7112 !! test
7113 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7114 !! input
7115 <blockquote>
7116 Line one
7117
7118 Line two</blockquote>
7119 !! result
7120 <blockquote>
7121 <p>Line one
7122 </p>
7123 Line two</blockquote>
7124
7125 !! end
7126
7127 !! test
7128 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7129 !! input
7130 <blockquote>Line one
7131
7132 Line two
7133 </blockquote>
7134 !! result
7135 <blockquote>Line one
7136 <p>Line two
7137 </p>
7138 </blockquote>
7139
7140 !! end
7141
7142 !! test
7143 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7144 !! input
7145 <blockquote>
7146 Line one
7147
7148 Line two
7149 </blockquote>
7150 !! result
7151 <blockquote>
7152 <p>Line one
7153 </p><p>Line two
7154 </p>
7155 </blockquote>
7156
7157 !! end
7158
7159 !! test
7160 Paragraphs inside blockquotes/divs (no extra line breaks)
7161 !! input
7162 <blockquote><div>Line one
7163
7164 Line two</div></blockquote>
7165 !! result
7166 <blockquote><div>Line one
7167 Line two</div></blockquote>
7168
7169 !! end
7170
7171 !! test
7172 Paragraphs inside blockquotes/divs (extra line break on open)
7173 !! input
7174 <blockquote><div>
7175 Line one
7176
7177 Line two</div></blockquote>
7178 !! result
7179 <blockquote><div>
7180 <p>Line one
7181 </p>
7182 Line two</div></blockquote>
7183
7184 !! end
7185
7186 !! test
7187 Paragraphs inside blockquotes/divs (extra line break on close)
7188 !! input
7189 <blockquote><div>Line one
7190
7191 Line two
7192 </div></blockquote>
7193 !! result
7194 <blockquote><div>Line one
7195 <p>Line two
7196 </p>
7197 </div></blockquote>
7198
7199 !! end
7200
7201 !! test
7202 Paragraphs inside blockquotes/divs (extra line break on open and close)
7203 !! input
7204 <blockquote><div>
7205 Line one
7206
7207 Line two
7208 </div></blockquote>
7209 !! result
7210 <blockquote><div>
7211 <p>Line one
7212 </p><p>Line two
7213 </p>
7214 </div></blockquote>
7215
7216 !! end
7217
7218 !! test
7219 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7220 !! options
7221 wgLinkHolderBatchSize=0
7222 !! input
7223 [[meatball:1]]
7224 [[meatball:2]]
7225 [[meatball:3]]
7226 !! result
7227 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7228 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7229 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7230 </p>
7231 !! end
7232
7233 !! test
7234 Free external link invading image caption
7235 !! input
7236 [[Image:Foobar.jpg|thumb|http://x|hello]]
7237 !! result
7238 <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>
7239
7240 !! end
7241
7242 !! test
7243 Bug 15196: localised external link numbers
7244 !! options
7245 language=fa
7246 !! input
7247 [http://en.wikipedia.org/]
7248 !! result
7249 <p><a href="http://en.wikipedia.org/" class="external autonumber" title="http://en.wikipedia.org/" rel="nofollow">[۱]</a>
7250 </p>
7251 !! end
7252
7253 !! test
7254 Multibyte character in padleft
7255 !! input
7256 {{padleft:-Hello|7|Æ}}
7257 !! result
7258 <p>Æ-Hello
7259 </p>
7260 !! end
7261
7262 !! test
7263 Multibyte character in padright
7264 !! input
7265 {{padright:Hello-|7|Æ}}
7266 !! result
7267 <p>Hello-Æ
7268 </p>
7269 !! end
7270
7271 !! test
7272 Formatted date
7273 !! config
7274 wgUseDynamicDates=1
7275 !! input
7276 [[2009-03-24]]
7277 !! result
7278 <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>
7279 </p>
7280 !!end
7281
7282 !!test
7283 formatdate parser function
7284 !!input
7285 {{#formatdate:2009-03-24}}
7286 !! result
7287 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
7288 </p>
7289 !! end
7290
7291 !!test
7292 formatdate parser function, with default format
7293 !!input
7294 {{#formatdate:2009-03-24|mdy}}
7295 !! result
7296 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
7297 </p>
7298 !! end
7299
7300 !! test
7301 Linked date with autoformatting disabled
7302 !! config
7303 wgUseDynamicDates=false
7304 !! input
7305 [[2009-03-24]]
7306 !! result
7307 <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>
7308 </p>
7309 !!end
7310
7311 #
7312 #
7313 #
7314
7315 TODO:
7316 more images
7317 more tables
7318 math
7319 character entities
7320 and much more
7321 Try for 100% code coverage