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