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