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