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