Hopefully fix main parsertests (thanks Rob)
[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 TODO: Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2006-April/034637.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 TODO: 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 ##
1570 ## XHTML tidiness
1571 ###
1572
1573 !! test
1574 <br> to <br />
1575 !! input
1576 1<br>2<br />3
1577 !! result
1578 <p>1<br />2<br />3
1579 </p>
1580 !! end
1581
1582 !! test
1583 Incorrecly removing closing slashes from correctly formed XHTML
1584 !! input
1585 <br style="clear:both;" />
1586 !! result
1587 <p><br style="clear:both;" />
1588 </p>
1589 !! end
1590
1591 !! test
1592 Failing to transform badly formed HTML into correct XHTML
1593 !! input
1594 <br clear=left>
1595 <br clear=right>
1596 <br clear=all>
1597 !! result
1598 <p><br clear="left" />
1599 <br clear="right" />
1600 <br clear="all" />
1601 </p>
1602 !!end
1603
1604 !! test
1605 Horizontal ruler (should it add that extra space?)
1606 !! input
1607 <hr>
1608 <hr >
1609 foo <hr
1610 > bar
1611 !! result
1612 <hr />
1613 <hr />
1614 foo <hr /> bar
1615
1616 !! end
1617
1618 ###
1619 ### Block-level elements
1620 ###
1621 !! test
1622 Common list
1623 !! input
1624 *Common list
1625 * item 2
1626 *item 3
1627 !! result
1628 <ul><li>Common list
1629 </li><li> item 2
1630 </li><li>item 3
1631 </li></ul>
1632
1633 !! end
1634
1635 !! test
1636 Numbered list
1637 !! input
1638 #Numbered list
1639 #item 2
1640 # item 3
1641 !! result
1642 <ol><li>Numbered list
1643 </li><li>item 2
1644 </li><li> item 3
1645 </li></ol>
1646
1647 !! end
1648
1649 !! test
1650 Mixed list
1651 !! input
1652 *Mixed list
1653 *# with numbers
1654 ** and bullets
1655 *# and numbers
1656 *bullets again
1657 **bullet level 2
1658 ***bullet level 3
1659 ***#Number on level 4
1660 **bullet level 2
1661 **#Number on level 3
1662 **#Number on level 3
1663 *#number level 2
1664 *Level 1
1665 !! result
1666 <ul><li>Mixed list
1667 <ol><li> with numbers
1668 </li></ol>
1669 <ul><li> and bullets
1670 </li></ul>
1671 <ol><li> and numbers
1672 </li></ol>
1673 </li><li>bullets again
1674 <ul><li>bullet level 2
1675 <ul><li>bullet level 3
1676 <ol><li>Number on level 4
1677 </li></ol>
1678 </li></ul>
1679 </li><li>bullet level 2
1680 <ol><li>Number on level 3
1681 </li><li>Number on level 3
1682 </li></ol>
1683 </li></ul>
1684 <ol><li>number level 2
1685 </li></ol>
1686 </li><li>Level 1
1687 </li></ul>
1688
1689 !! end
1690
1691 !! test
1692 List items are not parsed correctly following a <pre> block (bug 785)
1693 !! input
1694 * <pre>foo</pre>
1695 * <pre>bar</pre>
1696 * zar
1697 !! result
1698 <ul><li> <pre>foo</pre>
1699 </li><li> <pre>bar</pre>
1700 </li><li> zar
1701 </li></ul>
1702
1703 !! end
1704
1705 ###
1706 ### Magic Words
1707 ###
1708
1709 !! test
1710 Magic Word: {{CURRENTDAY}}
1711 !! input
1712 {{CURRENTDAY}}
1713 !! result
1714 <p>1
1715 </p>
1716 !! end
1717
1718 !! test
1719 Magic Word: {{CURRENTDAY2}}
1720 !! input
1721 {{CURRENTDAY2}}
1722 !! result
1723 <p>01
1724 </p>
1725 !! end
1726
1727 !! test
1728 Magic Word: {{CURRENTDAYNAME}}
1729 !! input
1730 {{CURRENTDAYNAME}}
1731 !! result
1732 <p>Thursday
1733 </p>
1734 !! end
1735
1736 !! test
1737 Magic Word: {{CURRENTDOW}}
1738 !! input
1739 {{CURRENTDOW}}
1740 !! result
1741 <p>4
1742 </p>
1743 !! end
1744
1745 !! test
1746 Magic Word: {{CURRENTMONTH}}
1747 !! input
1748 {{CURRENTMONTH}}
1749 !! result
1750 <p>01
1751 </p>
1752 !! end
1753
1754 !! test
1755 Magic Word: {{CURRENTMONTHABBREV}}
1756 !! input
1757 {{CURRENTMONTHABBREV}}
1758 !! result
1759 <p>Jan
1760 </p>
1761 !! end
1762
1763 !! test
1764 Magic Word: {{CURRENTMONTHNAME}}
1765 !! input
1766 {{CURRENTMONTHNAME}}
1767 !! result
1768 <p>January
1769 </p>
1770 !! end
1771
1772 !! test
1773 Magic Word: {{CURRENTMONTHNAMEGEN}}
1774 !! input
1775 {{CURRENTMONTHNAMEGEN}}
1776 !! result
1777 <p>January
1778 </p>
1779 !! end
1780
1781 !! test
1782 Magic Word: {{CURRENTTIME}}
1783 !! input
1784 {{CURRENTTIME}}
1785 !! result
1786 <p>00:02
1787 </p>
1788 !! end
1789
1790 !! test
1791 Magic Word: {{CURRENTWEEK}} (@bug 4594)
1792 !! input
1793 {{CURRENTWEEK}}
1794 !! result
1795 <p>1
1796 </p>
1797 !! end
1798
1799 !! test
1800 Magic Word: {{CURRENTYEAR}}
1801 !! input
1802 {{CURRENTYEAR}}
1803 !! result
1804 <p>1970
1805 </p>
1806 !! end
1807
1808 !! test
1809 Magic Word: {{FULLPAGENAME}}
1810 !! options
1811 title=[[User:Ævar Arnfjörð Bjarmason]]
1812 !! input
1813 {{FULLPAGENAME}}
1814 !! result
1815 <p>User:Ævar Arnfjörð Bjarmason
1816 </p>
1817 !! end
1818
1819 !! test
1820 Magic Word: {{FULLPAGENAMEE}}
1821 !! options
1822 title=[[User:Ævar Arnfjörð Bjarmason]]
1823 !! input
1824 {{FULLPAGENAMEE}}
1825 !! result
1826 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1827 </p>
1828 !! end
1829
1830 !! test
1831 Magic Word: {{NAMESPACE}}
1832 !! options
1833 title=[[User:Ævar Arnfjörð Bjarmason]]
1834 disabled # FIXME
1835 !! input
1836 {{NAMESPACE}}
1837 !! result
1838 <p>User
1839 </p>
1840 !! end
1841
1842 !! test
1843 Magic Word: {{NAMESPACEE}}
1844 !! options
1845 title=[[User:Ævar Arnfjörð Bjarmason]]
1846 disabled # FIXME
1847 !! input
1848 {{NAMESPACEE}}
1849 !! result
1850 <p>User
1851 </p>
1852 !! end
1853
1854 !! test
1855 Magic Word: {{NUMBEROFARTICLES}}
1856 !! input
1857 {{NUMBEROFARTICLES}}
1858 !! result
1859 <p>1
1860 </p>
1861 !! end
1862
1863 !! test
1864 Magic Word: {{NUMBEROFFILES}}
1865 !! input
1866 {{NUMBEROFFILES}}
1867 !! result
1868 <p>1
1869 </p>
1870 !! end
1871
1872 !! test
1873 Magic Word: {{PAGENAME}}
1874 !! options
1875 title=[[User:Ævar Arnfjörð Bjarmason]]
1876 disabled # FIXME
1877 !! input
1878 {{PAGENAME}}
1879 !! result
1880 <p>Ævar Arnfjörð Bjarmason
1881 </p>
1882 !! end
1883
1884 !! test
1885 Magic Word: {{PAGENAMEE}}
1886 !! options
1887 title=[[User:Ævar Arnfjörð Bjarmason]]
1888 !! input
1889 {{PAGENAMEE}}
1890 !! result
1891 <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
1892 </p>
1893 !! end
1894
1895 !! test
1896 Magic Word: {{REVISIONID}}
1897 !! input
1898 {{REVISIONID}}
1899 !! result
1900 <p>1337
1901 </p>
1902 !! end
1903
1904 !! test
1905 Magic Word: {{SCRIPTPATH}}
1906 !! input
1907 {{SCRIPTPATH}}
1908 !! result
1909 <p>/
1910 </p>
1911 !! end
1912
1913 !! test
1914 Magic Word: {{SERVER}}
1915 !! input
1916 {{SERVER}}
1917 !! result
1918 <p><a href="http://localhost" class="external free" title="http://localhost" rel="nofollow">http://localhost</a>
1919 </p>
1920 !! end
1921
1922 !! test
1923 Magic Word: {{SERVERNAME}}
1924 !! input
1925 {{SERVERNAME}}
1926 !! result
1927 <p>Britney Spears
1928 </p>
1929 !! end
1930
1931 !! test
1932 Magic Word: {{SITENAME}}
1933 !! input
1934 {{SITENAME}}
1935 !! result
1936 <p>MediaWiki
1937 </p>
1938 !! end
1939
1940 !! test
1941 Namespace 1 {{ns:1}}
1942 !! input
1943 {{ns:1}}
1944 !! result
1945 <p>Talk
1946 </p>
1947 !! end
1948
1949 !! test
1950 Namespace 1 {{ns:01}}
1951 !! input
1952 {{ns:01}}
1953 !! result
1954 <p>Talk
1955 </p>
1956 !! end
1957
1958 !! test
1959 Namespace 0 {{ns:0}} (bug 4783)
1960 !! input
1961 {{ns:0}}
1962 !! result
1963
1964 !! end
1965
1966 !! test
1967 Namespace 0 {{ns:00}} (bug 4783)
1968 !! input
1969 {{ns:00}}
1970 !! result
1971
1972 !! end
1973
1974 !! test
1975 Namespace -1 {{ns:-1}}
1976 !! input
1977 {{ns:-1}}
1978 !! result
1979 <p>Special
1980 </p>
1981 !! end
1982
1983 !! test
1984 Namespace Project {{ns:User}}
1985 !! input
1986 {{ns:User}}
1987 !! result
1988 <p>User
1989 </p>
1990 !! end
1991
1992
1993 ###
1994 ### Magic links
1995 ###
1996 !! test
1997 Magic links: internal link to RFC (bug 479)
1998 !! input
1999 [[RFC 123]]
2000 !! result
2001 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
2002 </p>
2003 !! end
2004
2005 !! test
2006 Magic links: RFC (bug 479)
2007 !! input
2008 RFC 822
2009 !! result
2010 <p><a href="http://tools.ietf.org/html/rfc822" class="external" title="http://tools.ietf.org/html/rfc822">RFC 822</a>
2011 </p>
2012 !! end
2013
2014 !! test
2015 Magic links: ISBN (bug 1937)
2016 !! input
2017 ISBN 0-306-40615-2
2018 !! result
2019 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
2020 </p>
2021 !! end
2022
2023 !! test
2024 Magic links: PMID incorrectly converts space to underscore
2025 !! input
2026 PMID 1234
2027 !! result
2028 <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>
2029 </p>
2030 !! end
2031
2032 ###
2033 ### Templates
2034 ####
2035
2036 !! test
2037 Nonexistant template
2038 !! input
2039 {{thistemplatedoesnotexist}}
2040 !! result
2041 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
2042 </p>
2043 !! end
2044
2045 !! article
2046 Template:test
2047 !! text
2048 This is a test template
2049 !! endarticle
2050
2051 !! test
2052 Simple template
2053 !! input
2054 {{test}}
2055 !! result
2056 <p>This is a test template
2057 </p>
2058 !! end
2059
2060 !! test
2061 Template with explicit namespace
2062 !! input
2063 {{Template:test}}
2064 !! result
2065 <p>This is a test template
2066 </p>
2067 !! end
2068
2069
2070 !! article
2071 Template:paramtest
2072 !! text
2073 This is a test template with parameter {{{param}}}
2074 !! endarticle
2075
2076 !! test
2077 Template parameter
2078 !! input
2079 {{paramtest|param=foo}}
2080 !! result
2081 <p>This is a test template with parameter foo
2082 </p>
2083 !! end
2084
2085 !! article
2086 Template:paramtestnum
2087 !! text
2088 [[{{{1}}}|{{{2}}}]]
2089 !! endarticle
2090
2091 !! test
2092 Template unnamed parameter
2093 !! input
2094 {{paramtestnum|Main Page|the main page}}
2095 !! result
2096 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
2097 </p>
2098 !! end
2099
2100 !! article
2101 Template:templatesimple
2102 !! text
2103 (test)
2104 !! endarticle
2105
2106 !! article
2107 Template:templateredirect
2108 !! text
2109 #redirect [[Template:templatesimple]]
2110 !! endarticle
2111
2112 !! article
2113 Template:templateasargtestnum
2114 !! text
2115 {{{{{1}}}}}
2116 !! endarticle
2117
2118 !! article
2119 Template:templateasargtest
2120 !! text
2121 {{template{{{templ}}}}}
2122 !! endarticle
2123
2124 !! article
2125 Template:templateasargtest2
2126 !! text
2127 {{{{{templ}}}}}
2128 !! endarticle
2129
2130 !! test
2131 Template with template name as unnamed argument
2132 !! input
2133 {{templateasargtestnum|templatesimple}}
2134 !! result
2135 <p>(test)
2136 </p>
2137 !! end
2138
2139 !! test
2140 Template with template name as argument
2141 !! input
2142 {{templateasargtest|templ=simple}}
2143 !! result
2144 <p>(test)
2145 </p>
2146 !! end
2147
2148 !! test
2149 Template with template name as argument (2)
2150 !! input
2151 {{templateasargtest2|templ=templatesimple}}
2152 !! result
2153 <p>(test)
2154 </p>
2155 !! end
2156
2157 !! article
2158 Template:templateasargtestdefault
2159 !! text
2160 {{{{{templ|templatesimple}}}}}
2161 !! endarticle
2162
2163 !! article
2164 Template:templa
2165 !! text
2166 '''templ'''
2167 !! endarticle
2168
2169 !! test
2170 Template with default value
2171 !! input
2172 {{templateasargtestdefault}}
2173 !! result
2174 <p>(test)
2175 </p>
2176 !! end
2177
2178 !! test
2179 Template with default value (value set)
2180 !! input
2181 {{templateasargtestdefault|templ=templa}}
2182 !! result
2183 <p><b>templ</b>
2184 </p>
2185 !! end
2186
2187 !! test
2188 Template redirect
2189 !! input
2190 {{templateredirect}}
2191 !! result
2192 <p>(test)
2193 </p>
2194 !! end
2195
2196 !! test
2197 Template with argument in separate line
2198 !! input
2199 {{ templateasargtest |
2200 templ = simple }}
2201 !! result
2202 <p>(test)
2203 </p>
2204 !! end
2205
2206 !! test
2207 Template with complex template as argument
2208 !! input
2209 {{paramtest|
2210 param ={{ templateasargtest |
2211 templ = simple }}}}
2212 !! result
2213 <p>This is a test template with parameter (test)
2214 </p>
2215 !! end
2216
2217 !! test
2218 Template with thumb image (with link in description)
2219 !! input
2220 {{paramtest|
2221 param =[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
2222 !! result
2223 This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:122px;"><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>
2224
2225 !! end
2226
2227 !! article
2228 Template:complextemplate
2229 !! text
2230 {{{1}}} {{paramtest|
2231 param ={{{param}}}}}
2232 !! endarticle
2233
2234 !! test
2235 Template with complex arguments
2236 !! input
2237 {{complextemplate|
2238 param ={{ templateasargtest |
2239 templ = simple }}|[[Template:complextemplate|link]]}}
2240 !! result
2241 <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
2242 </p>
2243 !! end
2244
2245 !! test
2246 BUG 553: link with two variables in a piped link
2247 !! input
2248 {|
2249 |[[{{{1}}}|{{{2}}}]]
2250 |}
2251 !! result
2252 <table>
2253 <tr>
2254 <td>[[{{{1}}}|{{{2}}}]]
2255 </td></tr></table>
2256
2257 !! end
2258
2259 !! test
2260 Magic variable as template parameter
2261 !! input
2262 {{paramtest|param={{SITENAME}}}}
2263 !! result
2264 <p>This is a test template with parameter MediaWiki
2265 </p>
2266 !! end
2267
2268 !! article
2269 Template:linktest
2270 !! text
2271 [[{{{param}}}|link]]
2272 !! endarticle
2273
2274 !! test
2275 Template parameter as link source
2276 !! input
2277 {{linktest|param=Main Page}}
2278 !! result
2279 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
2280 </p>
2281 !! end
2282
2283
2284 !!article
2285 Template:paramtest2
2286 !! text
2287 including another template, {{paramtest|param={{{arg}}}}}
2288 !! endarticle
2289
2290 !! test
2291 Template passing argument to another template
2292 !! input
2293 {{paramtest2|arg='hmm'}}
2294 !! result
2295 <p>including another template, This is a test template with parameter 'hmm'
2296 </p>
2297 !! end
2298
2299 !! article
2300 Template:Linktest2
2301 !! text
2302 Main Page
2303 !! endarticle
2304
2305 !! test
2306 Template as link source
2307 !! input
2308 [[{{linktest2}}]]
2309 !! result
2310 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
2311 </p>
2312 !! end
2313
2314
2315 !! article
2316 Template:loop1
2317 !! text
2318 {{loop2}}
2319 !! endarticle
2320
2321 !! article
2322 Template:loop2
2323 !! text
2324 {{loop1}}
2325 !! endarticle
2326
2327 !! test
2328 Template infinite loop
2329 !! input
2330 {{loop1}}
2331 !! result
2332 <p><a href="/index.php?title=Loop1&amp;action=edit" class="new" title="Loop1">loop1</a><!-- WARNING: template loop detected -->
2333 </p>
2334 !! end
2335
2336 !! test
2337 Template from main namespace
2338 !! input
2339 {{:Main Page}}
2340 !! result
2341 <p>blah blah
2342 </p>
2343 !! end
2344
2345 !! article
2346 Template:table
2347 !! text
2348 {|
2349 | 1 || 2
2350 |-
2351 | 3 || 4
2352 |}
2353 !! endarticle
2354
2355 !! test
2356 BUG 529: Template with table, not included at beginning of line
2357 !! input
2358 foo {{table}}
2359 !! result
2360 <p>foo
2361 </p>
2362 <table>
2363 <tr>
2364 <td> 1 </td><td> 2
2365 </td></tr>
2366 <tr>
2367 <td> 3 </td><td> 4
2368 </td></tr></table>
2369
2370 !! end
2371
2372 !! test
2373 BUG 523: Template shouldn't eat newline (or add an extra one before table)
2374 !! input
2375 foo
2376 {{table}}
2377 !! result
2378 <p>foo
2379 </p>
2380 <table>
2381 <tr>
2382 <td> 1 </td><td> 2
2383 </td></tr>
2384 <tr>
2385 <td> 3 </td><td> 4
2386 </td></tr></table>
2387
2388 !! end
2389
2390 !! test
2391 BUG 41: Template parameters shown as broken links
2392 !! input
2393 {{{parameter}}}
2394 !! result
2395 <p>{{{parameter}}}
2396 </p>
2397 !! end
2398
2399
2400 !! article
2401 Template:MSGNW test
2402 !! text
2403 ''None'' of '''this''' should be
2404 * interepreted
2405 but rather passed unmodified
2406 {{test}}
2407 !! endarticle
2408
2409 # hmm, fix this or just deprecate msgnw and document its behavior?
2410 !! test
2411 msgnw keyword
2412 !! options
2413 disabled
2414 !! input
2415 {{msgnw:MSGNW test}}
2416 !! result
2417 <p>''None'' of '''this''' should be
2418 * interepreted
2419 but rather passed unmodified
2420 {{test}}
2421 </p>
2422 !! end
2423
2424 !! test
2425 int keyword
2426 !! input
2427 {{int:youhavenewmessages|lots of money|not!}}
2428 !! result
2429 <p>You have lots of money (not!).
2430 </p>
2431 !! end
2432
2433 !! article
2434 Template:Includes
2435 !! text
2436 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2437 !! endarticle
2438
2439 !! test
2440 <includeonly> and <noinclude> being included
2441 !! input
2442 {{Includes}}
2443 !! result
2444 <p>Foobar
2445 </p>
2446 !! end
2447
2448 !! article
2449 Template:Includes2
2450 !! text
2451 <onlyinclude>Foo</onlyinclude>bar
2452 !! endarticle
2453
2454 !! test
2455 <onlyinclude> being included
2456 !! input
2457 {{Includes2}}
2458 !! result
2459 <p>Foo
2460 </p>
2461 !! end
2462
2463
2464 !! article
2465 Template:Includes3
2466 !! text
2467 <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
2468 !! endarticle
2469
2470 !! test
2471 <onlyinclude> and <includeonly> being included
2472 !! input
2473 {{Includes3}}
2474 !! result
2475 <p>Foo
2476 </p>
2477 !! end
2478
2479 !! test
2480 <includeonly> and <noinclude> on a page
2481 !! input
2482 Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
2483 !! result
2484 <p>Foozar
2485 </p>
2486 !! end
2487
2488 !! test
2489 <onlyinclude> on a page
2490 !! input
2491 <onlyinclude>Foo</onlyinclude>bar
2492 !! result
2493 <p>Foobar
2494 </p>
2495 !! end
2496
2497 ###
2498 ### Pre-save transform tests
2499 ###
2500 !! test
2501 pre-save transform: subst:
2502 !! options
2503 PST
2504 !! input
2505 {{subst:test}}
2506 !! result
2507 This is a test template
2508 !! end
2509
2510 !! test
2511 pre-save transform: normal template
2512 !! options
2513 PST
2514 !! input
2515 {{test}}
2516 !! result
2517 {{test}}
2518 !! end
2519
2520 !! test
2521 pre-save transform: nonexistant template
2522 !! options
2523 PST
2524 !! input
2525 {{thistemplatedoesnotexist}}
2526 !! result
2527 {{thistemplatedoesnotexist}}
2528 !! end
2529
2530
2531 !! test
2532 pre-save transform: subst magic variables
2533 !! options
2534 PST
2535 !! input
2536 {{subst:SITENAME}}
2537 !! result
2538 MediaWiki
2539 !! end
2540
2541 # This is bug 89, which I fixed. -- wtm
2542 !! test
2543 pre-save transform: subst: templates with parameters
2544 !! options
2545 pst
2546 !! input
2547 {{subst:paramtest|param="something else"}}
2548 !! result
2549 This is a test template with parameter "something else"
2550 !! end
2551
2552 !! article
2553 Template:nowikitest
2554 !! text
2555 <nowiki>'''not wiki'''</nowiki>
2556 !! endarticle
2557
2558 !! test
2559 pre-save transform: nowiki in subst (bug 1188)
2560 !! options
2561 pst
2562 !! input
2563 {{subst:nowikitest}}
2564 !! result
2565 <nowiki>'''not wiki'''</nowiki>
2566 !! end
2567
2568
2569 !! article
2570 Template:commenttest
2571 !! text
2572 This template has <!-- a comment --> in it.
2573 !! endarticle
2574
2575 !! test
2576 pre-save transform: comment in subst (bug 1936)
2577 !! options
2578 pst
2579 !! input
2580 {{subst:commenttest}}
2581 !! result
2582 This template has <!-- a comment --> in it.
2583 !! end
2584
2585 !! test
2586 pre-save transform: unclosed tag
2587 !! options
2588 pst noxml
2589 !! input
2590 <nowiki>'''not wiki'''
2591 !! result
2592 <nowiki>'''not wiki'''
2593 !! end
2594
2595 !! test
2596 pre-save transform: mixed tag case
2597 !! options
2598 pst noxml
2599 !! input
2600 <NOwiki>'''not wiki'''</noWIKI>
2601 !! result
2602 <NOwiki>'''not wiki'''</noWIKI>
2603 !! end
2604
2605 !! test
2606 pre-save transform: unclosed comment in <nowiki>
2607 !! options
2608 pst noxml
2609 !! input
2610 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2611 !! result
2612 wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
2613 !!end
2614
2615 !! article
2616 Template:dangerous
2617 !!text
2618 <span onmouseover="alert('crap')">Oh no</span>
2619 !!endarticle
2620
2621 !!test
2622 (confirming safety of fix for subst bug 1936)
2623 !! input
2624 {{Template:dangerous}}
2625 !! result
2626 <p><span>Oh no</span>
2627 </p>
2628 !! end
2629
2630 !! test
2631 pre-save transform: comment containing gallery (bug 5024)
2632 !! options
2633 pst
2634 !! input
2635 <!-- <gallery>data</gallery> -->
2636 !!result
2637 <!-- <gallery>data</gallery> -->
2638 !!end
2639
2640 !! test
2641 pre-save transform: comment containing extension
2642 !! options
2643 pst
2644 !! input
2645 <!-- <tag>data</tag> -->
2646 !!result
2647 <!-- <tag>data</tag> -->
2648 !!end
2649
2650 !! test
2651 pre-save transform: comment containing nowiki
2652 !! options
2653 pst
2654 !! input
2655 <!-- <nowiki>data</nowiki> -->
2656 !!result
2657 <!-- <nowiki>data</nowiki> -->
2658 !!end
2659
2660 !! test
2661 pre-save transform: comment containing math
2662 !! options
2663 pst
2664 !! input
2665 <!-- <math>data</math> -->
2666 !!result
2667 <!-- <math>data</math> -->
2668 !!end
2669
2670 !! test
2671 pre-save transform: <noinclude> in subst (bug 3298)
2672 !! options
2673 pst
2674 !! input
2675 {{subst:Includes}}
2676 !! result
2677 Foobar
2678 !! end
2679
2680 !! test
2681 pre-save transform: <onlyinclude> in subst (bug 3298)
2682 !! options
2683 pst
2684 !! input
2685 {{subst:Includes2}}
2686 !! result
2687 Foo
2688 !! end
2689
2690 !! test
2691 pre-save transform: context links ("pipe trick")
2692 !! options
2693 pst
2694 !! input
2695 [[Article (context)|]]
2696 [[Bar:Article|]]
2697 [[:Bar:Article|]]
2698 [[Bar:Article (context)|]]
2699 [[:Bar:Article (context)|]]
2700 [[|Article]]
2701 [[|Article (context)]]
2702 [[Bar:X (Y) Z|]]
2703 [[:Bar:X (Y) Z|]]
2704 !! result
2705 [[Article (context)|Article]]
2706 [[Bar:Article|Article]]
2707 [[:Bar:Article|Article]]
2708 [[Bar:Article (context)|Article]]
2709 [[:Bar:Article (context)|Article]]
2710 [[Article]]
2711 [[Article (context)]]
2712 [[Bar:X (Y) Z|X (Y) Z]]
2713 [[:Bar:X (Y) Z|X (Y) Z]]
2714 !! end
2715
2716 !! test
2717 pre-save transform: context links ("pipe trick") with interwiki prefix
2718 !! options
2719 pst
2720 !! input
2721 [[interwiki:Article|]]
2722 [[:interwiki:Article|]]
2723 [[interwiki:Bar:Article|]]
2724 [[:interwiki:Bar:Article|]]
2725 !! result
2726 [[interwiki:Article|Article]]
2727 [[:interwiki:Article|Article]]
2728 [[interwiki:Bar:Article|Bar:Article]]
2729 [[:interwiki:Bar:Article|Bar:Article]]
2730 !! end
2731
2732 !! test
2733 pre-save transform: context links ("pipe trick") with parens in title
2734 !! options
2735 pst title=[[Somearticle (context)]]
2736 !! input
2737 [[|Article]]
2738 !! result
2739 [[Article (context)|Article]]
2740 !! end
2741
2742 !! test
2743 pre-save transform: context links ("pipe trick") with comma in title
2744 !! options
2745 pst title=[[Someplace, Somewhere]]
2746 !! input
2747 [[|Otherplace]]
2748 [[Otherplace, Elsewhere|]]
2749 [[Otherplace, Elsewhere, Anywhere|]]
2750 !! result
2751 [[Otherplace, Somewhere|Otherplace]]
2752 [[Otherplace, Elsewhere|Otherplace]]
2753 [[Otherplace, Elsewhere, Anywhere|Otherplace]]
2754 !! end
2755
2756 !! test
2757 pre-save transform: context links ("pipe trick") with parens and comma
2758 !! options
2759 pst title=[[Someplace (IGNORED), Somewhere]]
2760 !! input
2761 [[|Otherplace]]
2762 [[Otherplace (place), Elsewhere|]]
2763 !! result
2764 [[Otherplace, Somewhere|Otherplace]]
2765 [[Otherplace (place), Elsewhere|Otherplace]]
2766 !! end
2767
2768 !! test
2769 pre-save transform: context links ("pipe trick") with comma and parens
2770 !! options
2771 pst title=[[Who, me? (context)]]
2772 !! input
2773 [[|Yes, you.]]
2774 [[Me, Myself, and I (1937 song)|]]
2775 !! result
2776 [[Yes, you. (context)|Yes, you.]]
2777 [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
2778 !! end
2779
2780 !! test
2781 pre-save transform: context links ("pipe trick") with namespace
2782 !! options
2783 pst title=[[Ns:Somearticle]]
2784 !! input
2785 [[|Article]]
2786 !! result
2787 [[Ns:Article|Article]]
2788 !! end
2789
2790 !! test
2791 pre-save transform: context links ("pipe trick") with namespace and parens
2792 !! options
2793 pst title=[[Ns:Somearticle (context)]]
2794 !! input
2795 [[|Article]]
2796 !! result
2797 [[Ns:Article (context)|Article]]
2798 !! end
2799
2800 !! test
2801 pre-save transform: context links ("pipe trick") with namespace and comma
2802 !! options
2803 pst title=[[Ns:Somearticle, Context, Whatever]]
2804 !! input
2805 [[|Article]]
2806 !! result
2807 [[Ns:Article, Context, Whatever|Article]]
2808 !! end
2809
2810 !! test
2811 pre-save transform: context links ("pipe trick") with namespace, comma and parens
2812 !! options
2813 pst title=[[Ns:Somearticle, Context (context)]]
2814 !! input
2815 [[|Article]]
2816 !! result
2817 [[Ns:Article (context)|Article]]
2818 !! end
2819
2820 !! test
2821 pre-save transform: context links ("pipe trick") with namespace, parens and comma
2822 !! options
2823 pst title=[[Ns:Somearticle (IGNORED), Context]]
2824 !! input
2825 [[|Article]]
2826 !! result
2827 [[Ns:Article, Context|Article]]
2828 !! end
2829
2830
2831 ###
2832 ### Message transform tests
2833 ###
2834 !! test
2835 message transform: magic variables
2836 !! options
2837 msg
2838 !! input
2839 {{SITENAME}}
2840 !! result
2841 MediaWiki
2842 !! end
2843
2844 !! test
2845 message transform: should not transform wiki markup
2846 !! options
2847 msg
2848 !! input
2849 ''test''
2850 !! result
2851 ''test''
2852 !! end
2853
2854 !! test
2855 TODO: message transform: <noinclude> in transcluded template (bug 4926)
2856 !! options
2857 msg
2858 !! input
2859 {{Includes}}
2860 !! result
2861 Foobar
2862 !! end
2863
2864 !! test
2865 TODO: message transform: <onlyinclude> in transcluded template (bug 4926)
2866 !! options
2867 msg
2868 !! input
2869 {{Includes2}}
2870 !! result
2871 Foo
2872 !! end
2873
2874 !! test
2875 {{#special:}} page name, known
2876 !! options
2877 msg
2878 !! input
2879 {{#special:Recentchanges}}
2880 !! result
2881 Special:Recentchanges
2882 !! end
2883
2884 !! test
2885 {{#special:}} page name, unknown
2886 !! options
2887 msg
2888 !! input
2889 {{#special:foobarnonexistent}}
2890 !! result
2891 No such special page
2892 !! end
2893
2894 ###
2895 ### Images
2896 ###
2897 !! test
2898 Simple image
2899 !! input
2900 [[Image:foobar.jpg]]
2901 !! result
2902 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2903 </p>
2904 !! end
2905
2906 !! test
2907 Right-aligned image
2908 !! input
2909 [[Image:foobar.jpg|right]]
2910 !! result
2911 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2912
2913 !! end
2914
2915 !! test
2916 Image with caption
2917 !! input
2918 [[Image:foobar.jpg|right|Caption text]]
2919 !! result
2920 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="Caption text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
2921
2922 !! end
2923
2924 !! test
2925 Image with frame and link
2926 !! input
2927 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
2928 !! result
2929 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image Main Page"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This is a test image Main Page" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" 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>
2930
2931 !! end
2932
2933 !! test
2934 Link to image page- image page normally doesn't exists, hence edit link
2935 TODO: Add test with existing image page
2936 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
2937 !! input
2938 [[:Image:test]]
2939 !! result
2940 <p><a href="/index.php?title=Image:Test&amp;action=edit" class="new" title="Image:Test">Image:test</a>
2941 </p>
2942 !! end
2943
2944 !! test
2945 Frameless image caption with a free URL
2946 !! input
2947 [[Image:foobar.jpg|http://example.com]]
2948 !! result
2949 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="http://example.com" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
2950 </p>
2951 !! end
2952
2953 !! test
2954 Thumbnail image caption with a free URL
2955 !! input
2956 [[Image:foobar.jpg|thumb|http://example.com]]
2957 !! result
2958 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="http://example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
2959
2960 !! end
2961
2962 !! test
2963 BUG 1887: A ISBN with a thumbnail
2964 !! input
2965 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
2966 !! result
2967 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="ISBN 1235467890"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="ISBN 1235467890" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
2968
2969 !! end
2970
2971 !! test
2972 BUG 1887: A RFC with a thumbnail
2973 !! input
2974 [[Image:foobar.jpg|thumb|This is RFC 12354]]
2975 !! result
2976 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is RFC 12354"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is RFC 12354" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
2977
2978 !! end
2979
2980 !! test
2981 BUG 1887: A mailto link with a thumbnail
2982 !! input
2983 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
2984 !! result
2985 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Please mailto:nobody@example.com"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="Please mailto:nobody@example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
2986
2987 !! end
2988
2989 !! test
2990 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
2991 so math is not stripped and turns up as escaped &lt;math&gt; tags.
2992 !! input
2993 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
2994 !! result
2995 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="&lt;math&gt;2+2&lt;/math&gt;"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="&lt;math&gt;2+2&lt;/math&gt;" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
2996
2997 !! end
2998
2999 !! test
3000 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3001 !! options
3002 math
3003 !! input
3004 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3005 !! result
3006 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="2 + 2"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="2 + 2" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
3007
3008 !! end
3009
3010 # Pending resolution to bug 368
3011 !! test
3012 BUG 648: Frameless image caption with a link
3013 !! input
3014 [[Image:foobar.jpg|text with a [[link]] in it]]
3015 !! result
3016 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3017 </p>
3018 !! end
3019
3020 !! test
3021 BUG 648: Frameless image caption with a link (suffix)
3022 !! input
3023 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3024 !! result
3025 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a linkfoo in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3026 </p>
3027 !! end
3028
3029 !! test
3030 BUG 648: Frameless image caption with an interwiki link
3031 !! input
3032 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3033 !! result
3034 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a MeatBall:Link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3035 </p>
3036 !! end
3037
3038 !! test
3039 BUG 648: Frameless image caption with a piped interwiki link
3040 !! input
3041 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3042 !! result
3043 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="text with a link in it" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3044 </p>
3045 !! end
3046
3047 !! test
3048 Escape HTML special chars in image alt text
3049 !! input
3050 [[Image:foobar.jpg|& < > "]]
3051 !! result
3052 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&amp; &lt; &gt; &quot;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3053 </p>
3054 !! end
3055
3056 !! test
3057 BUG 499: Alt text should have &#1234;, not &amp;1234;
3058 !! input
3059 [[Image:foobar.jpg|&#9792;]]
3060 !! result
3061 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&#9792;"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="&#9792;" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3062 </p>
3063 !! end
3064
3065 !! test
3066 Broken image caption with link
3067 !! input
3068 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3069 !! result
3070 <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.
3071 </p>
3072 !! end
3073
3074 !! test
3075 Image caption containing another image
3076 !! input
3077 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3078 !! result
3079 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a caption with another Image:Icon.png inside it!"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is a caption with another Image:Icon.png inside it!" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
3080
3081 !! end
3082
3083 !! test
3084 Image caption containing a newline
3085 !! input
3086 [[Image:Foobar.jpg|This
3087 *is some text]]
3088 !! result
3089 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img src="http://example.com/images/3/3a/Foobar.jpg" alt="This *is some text" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3090 </p>
3091 !!end
3092
3093
3094 !! test
3095 Bug 3090: External links other than http: in image captions
3096 !! input
3097 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3098 !! result
3099 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This caption has irc and Secure ext links in it."><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" alt="This caption has irc and Secure ext links in it." width="200" height="23" longdesc="/wiki/Image:Foobar.jpg" 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>
3100
3101 !! end
3102
3103
3104 ###
3105 ### Subpages
3106 ###
3107 !! article
3108 Subpage test/subpage
3109 !! text
3110 foo
3111 !! endarticle
3112
3113 !! test
3114 Subpage link
3115 !! options
3116 subpage title=[[Subpage test]]
3117 !! input
3118 [[/subpage]]
3119 !! result
3120 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3121 </p>
3122 !! end
3123
3124 !! test
3125 Subpage noslash link
3126 !! options
3127 subpage title=[[Subpage test]]
3128 !!input
3129 [[/subpage/]]
3130 !! result
3131 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3132 </p>
3133 !! end
3134
3135 !! test
3136 Disabled subpages
3137 !! input
3138 [[/subpage]]
3139 !! result
3140 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
3141 </p>
3142 !! end
3143
3144 !! test
3145 BUG 561: {{/Subpage}}
3146 !! options
3147 subpage title=[[Page]]
3148 !! input
3149 {{/Subpage}}
3150 !! result
3151 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
3152 </p>
3153 !! end
3154
3155 ###
3156 ### Categories
3157 ###
3158 !! article
3159 Category:MediaWiki User's Guide
3160 !! text
3161 blah
3162 !! endarticle
3163
3164 !! test
3165 Link to category
3166 !! input
3167 [[:Category:MediaWiki User's Guide]]
3168 !! result
3169 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
3170 </p>
3171 !! end
3172
3173 !! test
3174 Simple category
3175 !! options
3176 cat
3177 !! input
3178 [[Category:MediaWiki User's Guide]]
3179 !! result
3180 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
3181 !! end
3182
3183 ###
3184 ### Inter-language links
3185 ###
3186 !! test
3187 Inter-language links
3188 !! options
3189 ill
3190 !! input
3191 [[es:Alimento]]
3192 [[fr:Nourriture]]
3193 [[zh:&#39135;&#21697;]]
3194 !! result
3195 es:Alimento fr:Nourriture zh:食品
3196 !! end
3197
3198 ###
3199 ### Sections
3200 ###
3201 !! test
3202 Basic section headings
3203 !! input
3204 == Headline 1 ==
3205 Some text
3206
3207 ==Headline 2==
3208 More
3209 ===Smaller headline===
3210 Blah blah
3211 !! result
3212 <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>
3213 <p>Some text
3214 </p>
3215 <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>
3216 <p>More
3217 </p>
3218 <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>
3219 <p>Blah blah
3220 </p>
3221 !! end
3222
3223 !! test
3224 Section headings with TOC
3225 !! input
3226 == Headline 1 ==
3227 === Subheadline 1 ===
3228 ===== Skipping a level =====
3229 ====== Skipping a level ======
3230
3231 == Headline 2 ==
3232 Some text
3233 ===Another headline===
3234 !! result
3235 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3236 <ul>
3237 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3238 <ul>
3239 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3240 <ul>
3241 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3242 <ul>
3243 <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>
3244 </ul>
3245 </li>
3246 </ul>
3247 </li>
3248 </ul>
3249 </li>
3250 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3251 <ul>
3252 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3253 </ul>
3254 </li>
3255 </ul>
3256 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3257 <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>
3258 <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>
3259 <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>
3260 <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>
3261 <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>
3262 <p>Some text
3263 </p>
3264 <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>
3265
3266 !! end
3267
3268 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3269 !! test
3270 Handling of sections up to level 6 and beyond
3271 !! input
3272 = Level 1 Heading=
3273 == Level 2 Heading==
3274 === Level 3 Heading===
3275 ==== Level 4 Heading====
3276 ===== Level 5 Heading=====
3277 ====== Level 6 Heading======
3278 ======= Level 7 Heading=======
3279 ======== Level 8 Heading========
3280 ========= Level 9 Heading=========
3281 ========== Level 10 Heading==========
3282 !! result
3283 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3284 <ul>
3285 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3286 <ul>
3287 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3288 <ul>
3289 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3290 <ul>
3291 <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>
3292 <ul>
3293 <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>
3294 <ul>
3295 <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>
3296 <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>
3297 <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>
3298 <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>
3299 <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>
3300 </ul>
3301 </li>
3302 </ul>
3303 </li>
3304 </ul>
3305 </li>
3306 </ul>
3307 </li>
3308 </ul>
3309 </li>
3310 </ul>
3311 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3312 <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>
3313 <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>
3314 <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>
3315 <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>
3316 <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>
3317 <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>
3318 <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>
3319 <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>
3320 <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>
3321 <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>
3322
3323 !! end
3324
3325 !! test
3326 Resolving duplicate section names
3327 !! input
3328 == Foo bar ==
3329 == Foo bar ==
3330 !! result
3331 <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>
3332 <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>
3333
3334 !! end
3335
3336 !! article
3337 Template:sections
3338 !! text
3339 ===Section 1===
3340 ==Section 2==
3341 !! endarticle
3342
3343 !! test
3344 Template with sections, __NOTOC__
3345 !! input
3346 __NOTOC__
3347 ==Section 0==
3348 {{sections}}
3349 ==Section 4==
3350 !! result
3351 <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>
3352 <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>
3353 <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>
3354 <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>
3355
3356 !! end
3357
3358 !! test
3359 __NOEDITSECTION__ keyword
3360 !! input
3361 __NOEDITSECTION__
3362 ==Section 1==
3363 ==Section 2==
3364 !! result
3365 <a name="Section_1"></a><h2> <span class="mw-headline">Section 1</span></h2>
3366 <a name="Section_2"></a><h2> <span class="mw-headline">Section 2</span></h2>
3367
3368 !! end
3369
3370 !! test
3371 Link inside a section heading
3372 !! input
3373 ==Section with a [[Main Page|link]] in it==
3374 !! result
3375 <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>
3376
3377 !! end
3378
3379
3380 !! test
3381 BUG 1219 URL next to image (good)
3382 !! input
3383 http://example.com [[Image:foobar.jpg]]
3384 !! result
3385 <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 src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3386 </p>
3387 !!end
3388
3389 !! test
3390 BUG 1219 URL next to image (broken)
3391 !! input
3392 http://example.com[[Image:foobar.jpg]]
3393 !! result
3394 <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 src="http://example.com/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>
3395 </p>
3396 !!end
3397
3398 !! test
3399 Bug 1186 news: in the middle of text
3400 !! input
3401 http://en.wikinews.org/wiki/Wikinews:Workplace
3402 !! result
3403 <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>
3404 </p>
3405 !!end
3406
3407
3408 !! test
3409 Namespaced link must have a title
3410 !! input
3411 [[Project:]]
3412 !! result
3413 <p>[[Project:]]
3414 </p>
3415 !!end
3416
3417 !! test
3418 Namespaced link must have a title (bad fragment version)
3419 !! input
3420 [[Project:#fragment]]
3421 !! result
3422 <p>[[Project:#fragment]]
3423 </p>
3424 !!end
3425
3426
3427 !! test
3428 div with no attributes
3429 !! input
3430 <div>HTML rocks</div>
3431 !! result
3432 <div>HTML rocks</div>
3433
3434 !! end
3435
3436 !! test
3437 div with double-quoted attribute
3438 !! input
3439 <div id="rock">HTML rocks</div>
3440 !! result
3441 <div id="rock">HTML rocks</div>
3442
3443 !! end
3444
3445 !! test
3446 div with single-quoted attribute
3447 !! input
3448 <div id='rock'>HTML rocks</div>
3449 !! result
3450 <div id="rock">HTML rocks</div>
3451
3452 !! end
3453
3454 !! test
3455 div with unquoted attribute
3456 !! input
3457 <div id=rock>HTML rocks</div>
3458 !! result
3459 <div id="rock">HTML rocks</div>
3460
3461 !! end
3462
3463 !! test
3464 div with illegal double attributes
3465 !! input
3466 <div align="center" align="right">HTML rocks</div>
3467 !! result
3468 <div align="right">HTML rocks</div>
3469
3470 !!end
3471
3472 !! test
3473 HTML multiple attributes correction
3474 !! input
3475 <p class="error" class="awesome">Awesome!</p>
3476 !! result
3477 <p class="awesome">Awesome!</p>
3478
3479 !!end
3480
3481 !! test
3482 Table multiple attributes correction
3483 !! input
3484 {|
3485 !+ class="error" class="awesome"| status
3486 |}
3487 !! result
3488 <table>
3489 <tr>
3490 <th class="awesome"> status
3491 </th></tr></table>
3492
3493 !!end
3494
3495 !! test
3496 DIV IN UPPERCASE
3497 !! input
3498 <DIV ALIGN="center">HTML ROCKS</DIV>
3499 !! result
3500 <div align="center">HTML ROCKS</div>
3501
3502 !!end
3503
3504
3505 !! test
3506 text with amp in the middle of nowhere
3507 !! input
3508 Remember AT&T?
3509 !!result
3510 <p>Remember AT&amp;T?
3511 </p>
3512 !! end
3513
3514 !! test
3515 text with character entity: eacute
3516 !! input
3517 I always thought &eacute; was a cute letter.
3518 !! result
3519 <p>I always thought &eacute; was a cute letter.
3520 </p>
3521 !! end
3522
3523 !! test
3524 text with undefined character entity: xacute
3525 !! input
3526 I always thought &xacute; was a cute letter.
3527 !! result
3528 <p>I always thought &amp;xacute; was a cute letter.
3529 </p>
3530 !! end
3531
3532
3533 ###
3534 ### Media links
3535 ###
3536
3537 !! test
3538 Media link
3539 !! input
3540 [[Media:Foobar.jpg]]
3541 !! result
3542 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3543 </p>
3544 !! end
3545
3546 !! test
3547 Media link with text
3548 !! input
3549 [[Media:Foobar.jpg|A neat file to look at]]
3550 !! result
3551 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3552 </p>
3553 !! end
3554
3555 # FIXME: this is still bad HTML tag nesting
3556 !! test
3557 Media link with nasty text
3558 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3559 !! input
3560 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3561 !! result
3562 <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>
3563
3564 !! end
3565
3566 !! test
3567 Media link to nonexistent file (bug 1702)
3568 !! input
3569 [[Media:No such.jpg]]
3570 !! result
3571 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3572 </p>
3573 !! end
3574
3575 !! test
3576 Image link to nonexistent file (bug 1850 - good)
3577 !! input
3578 [[Image:No such.jpg]]
3579 !! result
3580 <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>
3581 </p>
3582 !! end
3583
3584 !! test
3585 :Image link to nonexistent file (bug 1850 - bad)
3586 !! input
3587 [[:Image:No such.jpg]]
3588 !! result
3589 <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>
3590 </p>
3591 !! end
3592
3593
3594
3595 !! test
3596 Character reference normalization in link text (bug 1938)
3597 !! input
3598 [[Main Page|this&that]]
3599 !! result
3600 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3601 </p>
3602 !!end
3603
3604 !! test
3605 Empty attribute crash test (bug 2067)
3606 !! input
3607 <font color="">foo</font>
3608 !! result
3609 <p><font color="">foo</font>
3610 </p>
3611 !! end
3612
3613 !! test
3614 Empty attribute crash test single-quotes (bug 2067)
3615 !! input
3616 <font color=''>foo</font>
3617 !! result
3618 <p><font color="">foo</font>
3619 </p>
3620 !! end
3621
3622 !! test
3623 Attribute test: equals, then nothing
3624 !! input
3625 <font color=>foo</font>
3626 !! result
3627 <p><font>foo</font>
3628 </p>
3629 !! end
3630
3631 !! test
3632 Attribute test: unquoted value
3633 !! input
3634 <font color=x>foo</font>
3635 !! result
3636 <p><font color="x">foo</font>
3637 </p>
3638 !! end
3639
3640 !! test
3641 Attribute test: unquoted but illegal value (hash)
3642 !! input
3643 <font color=#x>foo</font>
3644 !! result
3645 <p><font color="#x">foo</font>
3646 </p>
3647 !! end
3648
3649 !! test
3650 Attribute test: no value
3651 !! input
3652 <font color>foo</font>
3653 !! result
3654 <p><font color="color">foo</font>
3655 </p>
3656 !! end
3657
3658 !! test
3659 Bug 2095: link with three closing brackets
3660 !! input
3661 [[Main Page]]]
3662 !! result
3663 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
3664 </p>
3665 !! end
3666
3667 !! test
3668 Bug 2095: link with pipe and three closing brackets
3669 !! input
3670 [[Main Page|link]]]
3671 !! result
3672 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
3673 </p>
3674 !! end
3675
3676 !! test
3677 Bug 2095: link with pipe and three closing brackets, version 2
3678 !! input
3679 [[Main Page|[http://example.com/]]]
3680 !! result
3681 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
3682 </p>
3683 !! end
3684
3685
3686 ###
3687 ### Safety
3688 ###
3689
3690 !! article
3691 Template:Dangerous attribute
3692 !! text
3693 " onmouseover="alert(document.cookie)
3694 !! endarticle
3695
3696 !! article
3697 Template:Dangerous style attribute
3698 !! text
3699 border-size: expression(alert(document.cookie))
3700 !! endarticle
3701
3702 !! article
3703 Template:Div style
3704 !! text
3705 <div style="float: right; {{{1}}}">Magic div</div>
3706 !! endarticle
3707
3708 !! test
3709 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
3710 !! input
3711 <div title="{{test}}"></div>
3712 !! result
3713 <div title="This is a test template"></div>
3714
3715 !! end
3716
3717 !! test
3718 Bug 2304: HTML attribute safety (dangerous template; 2309)
3719 !! input
3720 <div title="{{dangerous attribute}}"></div>
3721 !! result
3722 <div title=""></div>
3723
3724 !! end
3725
3726 !! test
3727 Bug 2304: HTML attribute safety (dangerous style template; 2309)
3728 !! input
3729 <div style="{{dangerous style attribute}}"></div>
3730 !! result
3731 <div></div>
3732
3733 !! end
3734
3735 !! test
3736 Bug 2304: HTML attribute safety (safe parameter; 2309)
3737 !! input
3738 {{div style|width: 200px}}
3739 !! result
3740 <div style="float: right; width: 200px">Magic div</div>
3741
3742 !! end
3743
3744 !! test
3745 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
3746 !! input
3747 {{div style|width: expression(alert(document.cookie))}}
3748 !! result
3749 <div>Magic div</div>
3750
3751 !! end
3752
3753 !! test
3754 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
3755 !! input
3756 {{div style|"><script>alert(document.cookie)</script>}}
3757 !! result
3758 <div>Magic div</div>
3759
3760 !! end
3761
3762 !! test
3763 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
3764 !! input
3765 {{div style|" ><script>alert(document.cookie)</script>}}
3766 !! result
3767 <div style="float: right;">Magic div</div>
3768
3769 !! end
3770
3771 !! test
3772 Bug 2304: HTML attribute safety (link)
3773 !! input
3774 <div title="[[Main Page]]"></div>
3775 !! result
3776 <div title="&#91;&#91;Main Page]]"></div>
3777
3778 !! end
3779
3780 !! test
3781 Bug 2304: HTML attribute safety (italics)
3782 !! input
3783 <div title="''foobar''"></div>
3784 !! result
3785 <div title="&#39;&#39;foobar&#39;&#39;"></div>
3786
3787 !! end
3788
3789 !! test
3790 Bug 2304: HTML attribute safety (bold)
3791 !! input
3792 <div title="'''foobar'''"></div>
3793 !! result
3794 <div title="&#39;&#39;'foobar&#39;&#39;'"></div>
3795
3796 !! end
3797
3798
3799 !! test
3800 Bug 2304: HTML attribute safety (ISBN)
3801 !! input
3802 <div title="ISBN 1234567890"></div>
3803 !! result
3804 <div title="&#73;SBN 1234567890"></div>
3805
3806 !! end
3807
3808 !! test
3809 Bug 2304: HTML attribute safety (RFC)
3810 !! input
3811 <div title="RFC 1234"></div>
3812 !! result
3813 <div title="&#82;FC 1234"></div>
3814
3815 !! end
3816
3817 !! test
3818 Bug 2304: HTML attribute safety (PMID)
3819 !! input
3820 <div title="PMID 1234567890"></div>
3821 !! result
3822 <div title="&#80;MID 1234567890"></div>
3823
3824 !! end
3825
3826 !! test
3827 Bug 2304: HTML attribute safety (web link)
3828 !! input
3829 <div title="http://example.com/"></div>
3830 !! result
3831 <div title="http&#58;//example.com/"></div>
3832
3833 !! end
3834
3835 !! test
3836 Bug 2304: HTML attribute safety (named web link)
3837 !! input
3838 <div title="[http://example.com/ link]"></div>
3839 !! result
3840 <div title="&#91;http&#58;//example.com/ link]"></div>
3841
3842 !! end
3843
3844 !! test
3845 Bug 3244: HTML attribute safety (extension; safe)
3846 !! input
3847 <div style="<nowiki>background:blue</nowiki>"></div>
3848 !! result
3849 <div style="background:blue"></div>
3850
3851 !! end
3852
3853 !! test
3854 Bug 3244: HTML attribute safety (extension; unsafe)
3855 !! input
3856 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
3857 !! result
3858 <div></div>
3859
3860 !! end
3861
3862 !! test
3863 Math section safety when disabled
3864 !! input
3865 <math><script>alert(document.cookies);</script></math>
3866 !! result
3867 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
3868 </p>
3869 !! end
3870
3871 # More MSIE fun discovered by Tom Gilder
3872
3873 !! test
3874 MSIE CSS safety test: spurious slash
3875 !! input
3876 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
3877 !! result
3878 <div>evil</div>
3879
3880 !! end
3881
3882 !! test
3883 MSIE CSS safety test: hex code
3884 !! input
3885 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
3886 !! result
3887 <div>evil</div>
3888
3889 !! end
3890
3891 !! test
3892 MSIE CSS safety test: comment in url
3893 !! input
3894 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
3895 !! result
3896 <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
3897
3898 !! end
3899
3900 !! test
3901 MSIE CSS safety test: comment in expression
3902 !! input
3903 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
3904 !! result
3905 <div style="background-image:expres sion(alert('boo4'))">evil4</div>
3906
3907 !! end
3908
3909
3910 !! test
3911 Table attribute legitimate extension
3912 !! input
3913 {|
3914 !+ style="<nowiki>color:blue</nowiki>"| status
3915 |}
3916 !! result
3917 <table>
3918 <tr>
3919 <th style="color:blue"> status
3920 </th></tr></table>
3921
3922 !!end
3923
3924 !! test
3925 Table attribute safety
3926 !! input
3927 {|
3928 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
3929 |}
3930 !! result
3931 <table>
3932 <tr>
3933 <th> status
3934 </th></tr></table>
3935
3936 !! end
3937
3938
3939 !! article
3940 Template:Identity
3941 !! text
3942 {{{1}}}
3943 !! endarticle
3944
3945 !! test
3946 Expansion of multi-line templates in attribute values (bug 6255)
3947 !! input
3948 <div style="background: {{identity|#00FF00}}">-</div>
3949 !! result
3950 <div style="background: #00FF00">-</div>
3951
3952 !! end
3953
3954
3955 !! test
3956 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
3957 !! input
3958 <div style="background:
3959 #00FF00">-</div>
3960 !! result
3961 <div style="background: #00FF00">-</div>
3962
3963 !! end
3964
3965 !! test
3966 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
3967 !! input
3968 <div style="background: &#10;#00FF00">-</div>
3969 !! result
3970 <div style="background: &#10;#00FF00">-</div>
3971
3972 !! end
3973
3974 ###
3975 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
3976 ###
3977 !! test
3978 Parser hook: empty input
3979 !! input
3980 <tag></tag>
3981 !! result
3982 <pre>
3983 string(0) ""
3984 array(0) {
3985 }
3986 </pre>
3987
3988 !! end
3989
3990 !! test
3991 Parser hook: empty input using terminated empty elements
3992 !! input
3993 <tag/>
3994 !! result
3995 <pre>
3996 NULL
3997 array(0) {
3998 }
3999 </pre>
4000
4001 !! end
4002
4003 !! test
4004 Parser hook: empty input using terminated empty elements (space before)
4005 !! input
4006 <tag />
4007 !! result
4008 <pre>
4009 NULL
4010 array(0) {
4011 }
4012 </pre>
4013
4014 !! end
4015
4016 !! test
4017 Parser hook: basic input
4018 !! input
4019 <tag>input</tag>
4020 !! result
4021 <pre>
4022 string(5) "input"
4023 array(0) {
4024 }
4025 </pre>
4026
4027 !! end
4028
4029
4030 !! test
4031 Parser hook: case insensetive
4032 !! input
4033 <TAG>input</TAG>
4034 !! result
4035 <pre>
4036 string(5) "input"
4037 array(0) {
4038 }
4039 </pre>
4040
4041 !! end
4042
4043
4044 !! test
4045 Parser hook: case insensetive, redux
4046 !! input
4047 <TaG>input</TAg>
4048 !! result
4049 <pre>
4050 string(5) "input"
4051 array(0) {
4052 }
4053 </pre>
4054
4055 !! end
4056
4057 !! test
4058 Parser hook: nested tags
4059 !! options
4060 noxml
4061 !! input
4062 <tag><tag></tag></tag>
4063 !! result
4064 <pre>
4065 string(5) "<tag>"
4066 array(0) {
4067 }
4068 </pre>&lt;/tag&gt;
4069
4070 !! end
4071
4072 !! test
4073 Parser hook: basic arguments
4074 !! input
4075 <tag width=200 height = "100" depth = '50' square></tag>
4076 !! result
4077 <pre>
4078 string(0) ""
4079 array(4) {
4080 ["width"]=>
4081 string(3) "200"
4082 ["height"]=>
4083 string(3) "100"
4084 ["depth"]=>
4085 string(2) "50"
4086 ["square"]=>
4087 string(6) "square"
4088 }
4089 </pre>
4090
4091 !! end
4092
4093 !! test
4094 Parser hook: argument containing a forward slash (bug 5344)
4095 !! input
4096 <tag filename='/tmp/bla'></tag>
4097 !! result
4098 <pre>
4099 string(0) ""
4100 array(1) {
4101 ["filename"]=>
4102 string(8) "/tmp/bla"
4103 }
4104 </pre>
4105
4106 !! end
4107
4108 !! test
4109 Parser hook: empty input using terminated empty elements (bug 2374)
4110 !! input
4111 <tag foo=bar/>text
4112 !! result
4113 <pre>
4114 NULL
4115 array(1) {
4116 ["foo"]=>
4117 string(3) "bar"
4118 }
4119 </pre>text
4120
4121 !! end
4122
4123 # </tag> should be output literally since there is no matching tag that begins it
4124 !! test
4125 Parser hook: basic arguments using terminated empty elements (bug 2374)
4126 !! input
4127 <tag width=200 height = "100" depth = '50' square/>
4128 other stuff
4129 </tag>
4130 !! result
4131 <pre>
4132 NULL
4133 array(4) {
4134 ["width"]=>
4135 string(3) "200"
4136 ["height"]=>
4137 string(3) "100"
4138 ["depth"]=>
4139 string(2) "50"
4140 ["square"]=>
4141 string(6) "square"
4142 }
4143 </pre>
4144 <p>other stuff
4145 &lt;/tag&gt;
4146 </p>
4147 !! end
4148
4149 ###
4150 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4151 ###
4152
4153 !! test
4154 Parser hook: static parser hook not inside a comment
4155 !! input
4156 <statictag>hello, world</statictag>
4157 <statictag action=flush/>
4158 !! result
4159 <p>hello, world
4160 </p>
4161 !! end
4162
4163
4164 !! test
4165 Parser hook: static parser hook inside a comment
4166 !! input
4167 <!-- <statictag>hello, world</statictag> -->
4168 <statictag action=flush/>
4169 !! result
4170 <p><br />
4171 </p>
4172 !! end
4173
4174 # Nested template calls; this case was broken by Parser.php rev 1.506,
4175 # since reverted.
4176
4177 !! article
4178 Template:One-parameter
4179 !! text
4180 (My parameter is: {{{1}}})
4181 !! endarticle
4182
4183 !! article
4184 Template:Map-one-parameter
4185 !! text
4186 {{{{{1}}}|{{{2}}}}}
4187 !! endarticle
4188
4189 !! test
4190 Nested template calls
4191 !! input
4192 {{Map-one-parameter|One-parameter|param}}
4193 !! result
4194 <p>(My parameter is: param)
4195 </p>
4196 !! end
4197
4198
4199 ###
4200 ### Sanitizer
4201 ###
4202 !! test
4203 Sanitizer: Closing of open tags
4204 !! input
4205 <s></s><table></table>
4206 !! result
4207 <s></s><table></table>
4208
4209 !! end
4210
4211 !! test
4212 Sanitizer: Closing of open but not closed tags
4213 !! input
4214 <s>foo
4215 !! result
4216 <p><s>foo</s>
4217 </p>
4218 !! end
4219
4220 !! test
4221 Sanitizer: Closing of closed but not open tags
4222 !! input
4223 </s>
4224 !! result
4225 <p>&lt;/s&gt;
4226 </p>
4227 !! end
4228
4229 !! test
4230 Sanitizer: Closing of closed but not open table tags
4231 !! input
4232 Table not started</td></tr></table>
4233 !! result
4234 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4235 </p>
4236 !! end
4237
4238 !! test
4239 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4240 !! input
4241 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4242 !! result
4243 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4244 </p>
4245 !! end
4246
4247 !! test
4248 Sanitizer: Validating the contents of the id attribute (bug 4515)
4249 !! options
4250 disabled
4251 !! input
4252 <br id=9 />
4253 !! result
4254 Something, but defenetly not <br id="9" />...
4255 !! end
4256
4257 !! test
4258 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4259 !! options
4260 disabled
4261 !! input
4262 <br id="foo" /><br id="foo" />
4263 !! result
4264 Something need to be done. foo-2 ?
4265 !! end
4266
4267 !! test
4268 Language converter: output gets cut off unexpectedly (bug 5757)
4269 !! options
4270 language=zh
4271 !! input
4272 this bit is safe: }-
4273
4274 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4275
4276 then we get cut off here: }-
4277
4278 all additional text is vanished
4279 !! result
4280 <p>this bit is safe: }-
4281 </p><p>but if we add a conversion instance: xxx
4282 </p><p>then we get cut off here: }-
4283 </p><p>all additional text is vanished
4284 </p>
4285 !! end
4286
4287 !! test
4288 Self closed html pairs (bug 5487)
4289 !! options
4290 !! input
4291 <center><font id="bug" />Centered text</center>
4292 <div><font id="bug2" />In div text</div>
4293 !! result
4294 <center>&lt;font id="bug" /&gt;Centered text</center>
4295 <div>&lt;font id="bug2" /&gt;In div text</div>
4296
4297 !! end
4298
4299 #
4300 #
4301 #
4302
4303 !! test
4304 HTML bullet list, closed tags (bug 5497)
4305 !! input
4306 <ul>
4307 <li>One</li>
4308 <li>Two</li>
4309 </ul>
4310 !! result
4311 <ul>
4312 <li>One</li>
4313 <li>Two</li>
4314 </ul>
4315
4316 !! end
4317
4318 !! test
4319 TODO: HTML bullet list, unclosed tags (bug 5497)
4320 !! input
4321 <ul>
4322 <li>One
4323 <li>Two
4324 </ul>
4325 !! result
4326 <ul>
4327 <li>One
4328 </li><li>Two
4329 </li></ul>
4330
4331 !! end
4332
4333 !! test
4334 HTML ordered list, closed tags (bug 5497)
4335 !! input
4336 <ol>
4337 <li>One</li>
4338 <li>Two</li>
4339 </ol>
4340 !! result
4341 <ol>
4342 <li>One</li>
4343 <li>Two</li>
4344 </ol>
4345
4346 !! end
4347
4348 !! test
4349 TODO: HTML ordered list, unclosed tags (bug 5497)
4350 !! input
4351 <ol>
4352 <li>One
4353 <li>Two
4354 </ol>
4355 !! result
4356 <ol>
4357 <li>One
4358 </li><li>Two
4359 </li></ol>
4360
4361 !! end
4362
4363 !! test
4364 HTML nested bullet list, closed tags (bug 5497)
4365 !! input
4366 <ul>
4367 <li>One</li>
4368 <li>Two:
4369 <ul>
4370 <li>Sub-one</li>
4371 <li>Sub-two</li>
4372 </ul>
4373 </li>
4374 </ul>
4375 !! result
4376 <ul>
4377 <li>One</li>
4378 <li>Two:
4379 <ul>
4380 <li>Sub-one</li>
4381 <li>Sub-two</li>
4382 </ul>
4383 </li>
4384 </ul>
4385
4386 !! end
4387
4388 !! test
4389 TODO: HTML nested bullet list, open tags (bug 5497)
4390 !! input
4391 <ul>
4392 <li>One
4393 <li>Two:
4394 <ul>
4395 <li>Sub-one
4396 <li>Sub-two
4397 </ul>
4398 </ul>
4399 !! result
4400 <ul>
4401 <li>One
4402 </li><li>Two:
4403 <ul>
4404 <li>Sub-one
4405 </li><li>Sub-two
4406 </li></ul>
4407 </li></ul>
4408
4409 !! end
4410
4411 !! test
4412 HTML nested ordered list, closed tags (bug 5497)
4413 !! input
4414 <ol>
4415 <li>One</li>
4416 <li>Two:
4417 <ol>
4418 <li>Sub-one</li>
4419 <li>Sub-two</li>
4420 </ol>
4421 </li>
4422 </ol>
4423 !! result
4424 <ol>
4425 <li>One</li>
4426 <li>Two:
4427 <ol>
4428 <li>Sub-one</li>
4429 <li>Sub-two</li>
4430 </ol>
4431 </li>
4432 </ol>
4433
4434 !! end
4435
4436 !! test
4437 TODO: HTML nested ordered list, open tags (bug 5497)
4438 !! input
4439 <ol>
4440 <li>One
4441 <li>Two:
4442 <ol>
4443 <li>Sub-one
4444 <li>Sub-two
4445 </ol>
4446 </ol>
4447 !! result
4448 <ol>
4449 <li>One
4450 </li><li>Two:
4451 <ol>
4452 <li>Sub-one
4453 </li><li>Sub-two
4454 </li></ol>
4455 </li></ol>
4456
4457 !! end
4458
4459 !! test
4460 HTML ordered list item with parameters oddity
4461 !! input
4462 <ol><li id="fragment">One</li></ol>
4463 !! result
4464 <ol><li id="fragment">One</li></ol>
4465
4466 !! end
4467
4468 !!test
4469 bug 5918: autonumbering
4470 !! input
4471 [http://first/] [http://second] [ftp://ftp]
4472
4473 ftp://inlineftp
4474
4475 [mailto:enclosed@mail.tld With target]
4476
4477 [mailto:enclosed@mail.tld]
4478
4479 mailto:inline@mail.tld
4480 !! result
4481 <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>
4482 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4483 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4484 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4485 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4486 </p>
4487 !! end
4488
4489
4490 #
4491 # Security and HTML correctness
4492 # From Nick Jenkins' fuzz testing
4493 #
4494
4495 !! test
4496 Fuzz testing: Parser13
4497 !! input
4498 {|
4499 | http://a|
4500 !! result
4501 <table>
4502 <tr>
4503 <td>
4504 </td>
4505 </tr>
4506 </table>
4507
4508 !! end
4509
4510 !! test
4511 Fuzz testing: Parser14
4512 !! input
4513 == onmouseover= ==
4514 http://__TOC__
4515 !! result
4516 <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>
4517 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4518 <ul>
4519 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4520 </ul>
4521 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4522
4523 !! end
4524
4525 !! test
4526 Fuzz testing: Parser14-table
4527 !! input
4528 ==a==
4529 {| STYLE=__TOC__
4530 !! result
4531 <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>
4532 <table style="&#95;_TOC&#95;_">
4533 <tr><td></td></tr>
4534 </table>
4535
4536 !! end
4537
4538 # Known to produce bogus xml (extra </td>)
4539 !! test
4540 Fuzz testing: Parser16
4541 !! options
4542 noxml
4543 !! input
4544 {|
4545 !https://||||||
4546 !! result
4547 <table>
4548 <tr>
4549 <th>https://</th><th></th><th></th><th>
4550 </td>
4551 </tr>
4552 </table>
4553
4554 !! end
4555
4556 !! test
4557 Fuzz testing: Parser21
4558 !! input
4559 {|
4560 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4561 |
4562 !! result
4563 <table>
4564 <tr>
4565 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4566 </th><td>
4567 </td>
4568 </tr>
4569 </table>
4570
4571 !! end
4572
4573 !! test
4574 Fuzz testing: Parser22
4575 !! input
4576 http://===r:::https://b
4577
4578 {|
4579 !!result
4580 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4581 </p>
4582 <table>
4583 <tr><td></td></tr>
4584 </table>
4585
4586 !! end
4587
4588 # Known to produce bad XML for now
4589 !! test
4590 Fuzz testing: Parser24
4591 !! options
4592 noxml
4593 !! input
4594 {|
4595 {{{|
4596 <u CLASS=
4597 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4598 <br style="onmouseover='alert(document.cookie);' " />
4599
4600 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4601 |
4602 !! result
4603 <table>
4604
4605 <u class="&#124;">} &gt;
4606 <br style="onmouseover='alert(document.cookie);'" />
4607
4608 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4609 <tr>
4610 <td></u>
4611 </td>
4612 </tr>
4613 </table>
4614
4615 !! end
4616
4617 # Known to produce bad XML for now
4618 !!test
4619 Fuzz testing: Parser25 (bug 6055)
4620 !! options
4621 noxml
4622 !! input
4623 {{{
4624 |
4625 <LI CLASS=||
4626 >
4627 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
4628 !! result
4629 <li class="&#124;&#124;">
4630 blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
4631
4632 !! end
4633
4634 !!test
4635 Fuzz testing: URL adjacent extension (with space, clean)
4636 !! options
4637 !! input
4638 http://example.com <nowiki>junk</nowiki>
4639 !! result
4640 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
4641 </p>
4642 !!end
4643
4644 !!test
4645 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
4646 !! options
4647 !! input
4648 http://example.com<nowiki>junk</nowiki>
4649 !! result
4650 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
4651 </p>
4652 !!end
4653
4654 !!test
4655 Fuzz testing: URL adjacent extension (no space, dirty; pre)
4656 !! options
4657 !! input
4658 http://example.com<pre>junk</pre>
4659 !! result
4660 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
4661
4662 !!end
4663
4664 !!test
4665 Fuzz testing: image with bogus manual thumbnail
4666 !!input
4667 [[Image:foobar.jpg|thumbnail= ]]
4668 !!result
4669 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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></div></div></div>
4670
4671 !!end
4672
4673 !! test
4674 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
4675 !! input
4676 <pre dir="&#10;"></pre>
4677 !! result
4678 <pre dir="&#10;"></pre>
4679
4680 !! end
4681
4682 !! test
4683 TODO: Parsing optional HTML elements (Bug 6171)
4684 !! options
4685 !! input
4686 <table>
4687 <tr>
4688 <td> Some tabular data</td>
4689 <td> More tabular data ...
4690 <td> And yet som tabular data</td>
4691 </tr>
4692 </table>
4693 !! result
4694 <table>
4695 <tr>
4696 <td> Some tabular data</td>
4697 <td> More tabular data ...
4698 </td><td> And yet som tabular data</td>
4699 </tr>
4700 </table>
4701
4702 !! end
4703
4704 !! test
4705 Correct handling of <td>, <tr> (Bug 6171)
4706 !! options
4707 !! input
4708 <table>
4709 <tr>
4710 <td> Some tabular data</td>
4711 <td> More tabular data ...</td>
4712 <td> And yet som tabular data</td>
4713 </tr>
4714 </table>
4715 !! result
4716 <table>
4717 <tr>
4718 <td> Some tabular data</td>
4719 <td> More tabular data ...</td>
4720 <td> And yet som tabular data</td>
4721 </tr>
4722 </table>
4723
4724 !! end
4725
4726
4727 !! test
4728 Parsing crashing regression (fr:JavaScript)
4729 !! input
4730 </body></x>
4731 !! result
4732 <p>&lt;/body&gt;&lt;/x&gt;
4733 </p>
4734 !! end
4735
4736 !! test
4737 Inline wiki vs wiki block nesting
4738 !! input
4739 '''Bold paragraph
4740
4741 New wiki paragraph
4742 !! result
4743 <p><b>Bold paragraph</b>
4744 </p><p>New wiki paragraph
4745 </p>
4746 !! end
4747
4748 !! test
4749 TODO: Inline HTML vs wiki block nesting
4750 !! input
4751 <b>Bold paragraph
4752
4753 New wiki paragraph
4754 !! result
4755 <p><b>Bold paragraph</b>
4756 </p><p>New wiki paragraph
4757 </p>
4758 !! end
4759
4760
4761 !!test
4762 TODO: Mixing markup for italics and bold
4763 !! options
4764 !! input
4765 '''bold''''''bold''bolditalics'''''
4766 !! result
4767 <p><b>bold</b><b>bold<i>bolditalics</i></b>
4768 </p>
4769 !! end
4770
4771
4772 !! article
4773 Xyzzyx
4774 !! text
4775 Article for special page transclusion test
4776 !! endarticle
4777
4778 !! test
4779 Special page transclusion
4780 !! options
4781 !! input
4782 {{Special:Prefixindex/Xyzzyx}}
4783 !! result
4784 <p><br />
4785 </p>
4786 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4787
4788 !! end
4789
4790 !! test
4791 Special page transclusion twice (bug 5021)
4792 !! options
4793 !! input
4794 {{Special:Prefixindex/Xyzzyx}}
4795 {{Special:Prefixindex/Xyzzyx}}
4796 !! result
4797 <p><br />
4798 </p>
4799 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4800 <p><br />
4801 </p>
4802 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
4803
4804 !! end
4805
4806 !! test
4807 Transclusion of default MediaWiki message
4808 !! input
4809 {{MediaWiki:Mainpage}}
4810 !!result
4811 <p>Main Page
4812 </p>
4813 !! end
4814
4815 !! test
4816 Transclusion of nonexistent MediaWiki message
4817 !! input
4818 {{MediaWiki:Mainpagexxx}}
4819 !!result
4820 <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit" class="new" title="MediaWiki:Mainpagexxx">MediaWiki:Mainpagexxx</a>
4821 </p>
4822 !! end
4823
4824 !! test
4825 Transclusion of MediaWiki message with underscore
4826 !! input
4827 {{MediaWiki:history_short}}
4828 !! result
4829 <p>History
4830 </p>
4831 !! end
4832
4833 !! test
4834 Transclusion of MediaWiki message with space
4835 !! input
4836 {{MediaWiki:history short}}
4837 !! result
4838 <p>History
4839 </p>
4840 !! end
4841
4842 !! test
4843 Invalid header with following text
4844 !! input
4845 = x = y
4846 !! result
4847 <p>= x = y
4848 </p>
4849 !! end
4850
4851
4852 !! test
4853 Section extraction test (section 0)
4854 !! options
4855 section=0
4856 !! input
4857 start
4858 ==a==
4859 ===aa===
4860 ====aaa====
4861 ==b==
4862 ===ba===
4863 ===bb===
4864 ====bba====
4865 ===bc===
4866 ==c==
4867 ===ca===
4868 !! result
4869 start
4870 !! end
4871
4872 !! test
4873 Section extraction test (section 1)
4874 !! options
4875 section=1
4876 !! input
4877 start
4878 ==a==
4879 ===aa===
4880 ====aaa====
4881 ==b==
4882 ===ba===
4883 ===bb===
4884 ====bba====
4885 ===bc===
4886 ==c==
4887 ===ca===
4888 !! result
4889 ==a==
4890 ===aa===
4891 ====aaa====
4892 !! end
4893
4894 !! test
4895 Section extraction test (section 2)
4896 !! options
4897 section=2
4898 !! input
4899 start
4900 ==a==
4901 ===aa===
4902 ====aaa====
4903 ==b==
4904 ===ba===
4905 ===bb===
4906 ====bba====
4907 ===bc===
4908 ==c==
4909 ===ca===
4910 !! result
4911 ===aa===
4912 ====aaa====
4913 !! end
4914
4915 !! test
4916 Section extraction test (section 3)
4917 !! options
4918 section=3
4919 !! input
4920 start
4921 ==a==
4922 ===aa===
4923 ====aaa====
4924 ==b==
4925 ===ba===
4926 ===bb===
4927 ====bba====
4928 ===bc===
4929 ==c==
4930 ===ca===
4931 !! result
4932 ====aaa====
4933 !! end
4934
4935 !! test
4936 Section extraction test (section 4)
4937 !! options
4938 section=4
4939 !! input
4940 start
4941 ==a==
4942 ===aa===
4943 ====aaa====
4944 ==b==
4945 ===ba===
4946 ===bb===
4947 ====bba====
4948 ===bc===
4949 ==c==
4950 ===ca===
4951 !! result
4952 ==b==
4953 ===ba===
4954 ===bb===
4955 ====bba====
4956 ===bc===
4957 !! end
4958
4959 !! test
4960 Section extraction test (section 5)
4961 !! options
4962 section=5
4963 !! input
4964 start
4965 ==a==
4966 ===aa===
4967 ====aaa====
4968 ==b==
4969 ===ba===
4970 ===bb===
4971 ====bba====
4972 ===bc===
4973 ==c==
4974 ===ca===
4975 !! result
4976 ===ba===
4977 !! end
4978
4979 !! test
4980 Section extraction test (section 6)
4981 !! options
4982 section=6
4983 !! input
4984 start
4985 ==a==
4986 ===aa===
4987 ====aaa====
4988 ==b==
4989 ===ba===
4990 ===bb===
4991 ====bba====
4992 ===bc===
4993 ==c==
4994 ===ca===
4995 !! result
4996 ===bb===
4997 ====bba====
4998 !! end
4999
5000 !! test
5001 Section extraction test (section 7)
5002 !! options
5003 section=7
5004 !! input
5005 start
5006 ==a==
5007 ===aa===
5008 ====aaa====
5009 ==b==
5010 ===ba===
5011 ===bb===
5012 ====bba====
5013 ===bc===
5014 ==c==
5015 ===ca===
5016 !! result
5017 ====bba====
5018 !! end
5019
5020 !! test
5021 Section extraction test (section 8)
5022 !! options
5023 section=8
5024 !! input
5025 start
5026 ==a==
5027 ===aa===
5028 ====aaa====
5029 ==b==
5030 ===ba===
5031 ===bb===
5032 ====bba====
5033 ===bc===
5034 ==c==
5035 ===ca===
5036 !! result
5037 ===bc===
5038 !! end
5039
5040 !! test
5041 Section extraction test (section 9)
5042 !! options
5043 section=9
5044 !! input
5045 start
5046 ==a==
5047 ===aa===
5048 ====aaa====
5049 ==b==
5050 ===ba===
5051 ===bb===
5052 ====bba====
5053 ===bc===
5054 ==c==
5055 ===ca===
5056 !! result
5057 ==c==
5058 ===ca===
5059 !! end
5060
5061 !! test
5062 Section extraction test (section 10)
5063 !! options
5064 section=10
5065 !! input
5066 start
5067 ==a==
5068 ===aa===
5069 ====aaa====
5070 ==b==
5071 ===ba===
5072 ===bb===
5073 ====bba====
5074 ===bc===
5075 ==c==
5076 ===ca===
5077 !! result
5078 ===ca===
5079 !! end
5080
5081 !! test
5082 Section extraction test (nonexistent section 11)
5083 !! options
5084 section=11
5085 !! input
5086 start
5087 ==a==
5088 ===aa===
5089 ====aaa====
5090 ==b==
5091 ===ba===
5092 ===bb===
5093 ====bba====
5094 ===bc===
5095 ==c==
5096 ===ca===
5097 !! result
5098 !! end
5099
5100 !! test
5101 Section extraction test with bogus heading (section 1)
5102 !! options
5103 section=1
5104 !! input
5105 ==a==
5106 ==bogus== not a legal section
5107 ==b==
5108 !! result
5109 ==a==
5110 ==bogus== not a legal section
5111 !! end
5112
5113 !! test
5114 Section extraction test with bogus heading (section 2)
5115 !! options
5116 section=2
5117 !! input
5118 ==a==
5119 ==bogus== not a legal section
5120 ==b==
5121 !! result
5122 ==b==
5123 !! end
5124
5125 !! test
5126 Section extraction test with comment after heading (section 1)
5127 !! options
5128 section=1
5129 !! input
5130 ==a==
5131 ==legal== <!-- a legal section -->
5132 ==b==
5133 !! result
5134 ==a==
5135 !! end
5136
5137 !! test
5138 Section extraction test with comment after heading (section 2)
5139 !! options
5140 section=2
5141 !! input
5142 ==a==
5143 ==legal== <!-- a legal section -->
5144 ==b==
5145 !! result
5146 ==legal== <!-- a legal section -->
5147 !! end
5148
5149 !! test
5150 Section extraction test with bogus <nowiki> heading (section 1)
5151 !! options
5152 section=1
5153 !! input
5154 ==a==
5155 ==bogus== <nowiki>not a legal section</nowiki>
5156 ==b==
5157 !! result
5158 ==a==
5159 ==bogus== <nowiki>not a legal section</nowiki>
5160 !! end
5161
5162 !! test
5163 Section extraction test with bogus <nowiki> heading (section 2)
5164 !! options
5165 section=2
5166 !! input
5167 ==a==
5168 ==bogus== <nowiki>not a legal section</nowiki>
5169 ==b==
5170 !! result
5171 ==b==
5172 !! end
5173
5174
5175 !! test
5176 Section extraction prefixed by comment (section 1) (bug 2587)
5177 !! options
5178 section=1
5179 !! input
5180 <!-- -->==sec1==
5181 ==sec2==
5182 !!result
5183 <!-- -->==sec1==
5184 !!end
5185
5186 !! test
5187 Section extraction prefixed by comment (section 2) (bug 2587)
5188 !! options
5189 section=2
5190 !! input
5191 <!-- -->==sec1==
5192 ==sec2==
5193 !!result
5194 ==sec2==
5195 !!end
5196
5197
5198 !! test
5199 Section extraction, mixed wiki and html (section 1) (bug 2607)
5200 !! options
5201 section=1
5202 !! input
5203 <h2>1</h2>
5204 one
5205 ==2==
5206 two
5207 ==3==
5208 three
5209 !! result
5210 <h2>1</h2>
5211 one
5212 !! end
5213
5214 !! test
5215 Section extraction, mixed wiki and html (section 2) (bug 2607)
5216 !! options
5217 section=2
5218 !! input
5219 <h2>1</h2>
5220 one
5221 ==2==
5222 two
5223 ==3==
5224 three
5225 !! result
5226 ==2==
5227 two
5228 !! end
5229
5230
5231 !! test
5232 Section extraction, heading surrounded by <noinclude> (bug 3342)
5233 !! options
5234 section=1
5235 !! input
5236 <noinclude>==a==</noinclude>
5237 text
5238 !! result
5239 <noinclude>==a==</noinclude>
5240 text
5241 !!end
5242
5243
5244 !! test
5245 Section extraction, HTML heading subsections (bug 5272)
5246 !! options
5247 section=1
5248 !! input
5249 <h2>a</h2>
5250 <h3>aa</h3>
5251 <h2>b</h2>
5252 !! result
5253 <h2>a</h2>
5254 <h3>aa</h3>
5255 !! end
5256
5257 !! test
5258 Section extraction, HTML headings should be ignored in extensions (bug 3476)
5259 !! options
5260 section=2
5261 !! input
5262 <h2>a</h2>
5263 <tag>
5264 <h2>not b</h2>
5265 </tag>
5266 <h2>b</h2>
5267 !! result
5268 <h2>b</h2>
5269 !! end
5270
5271 !! test
5272 Section replacement test (section 0)
5273 !! options
5274 replace=0,"xxx"
5275 !! input
5276 start
5277 ==a==
5278 ===aa===
5279 ====aaa====
5280 ==b==
5281 ===ba===
5282 ===bb===
5283 ====bba====
5284 ===bc===
5285 ==c==
5286 ===ca===
5287 !! result
5288 xxx
5289
5290 ==a==
5291 ===aa===
5292 ====aaa====
5293 ==b==
5294 ===ba===
5295 ===bb===
5296 ====bba====
5297 ===bc===
5298 ==c==
5299 ===ca===
5300 !! end
5301
5302 !! test
5303 Section replacement test (section 1)
5304 !! options
5305 replace=1,"xxx"
5306 !! input
5307 start
5308 ==a==
5309 ===aa===
5310 ====aaa====
5311 ==b==
5312 ===ba===
5313 ===bb===
5314 ====bba====
5315 ===bc===
5316 ==c==
5317 ===ca===
5318 !! result
5319 start
5320 xxx
5321
5322 ==b==
5323 ===ba===
5324 ===bb===
5325 ====bba====
5326 ===bc===
5327 ==c==
5328 ===ca===
5329 !! end
5330
5331 !! test
5332 Section replacement test (section 2)
5333 !! options
5334 replace=2,"xxx"
5335 !! input
5336 start
5337 ==a==
5338 ===aa===
5339 ====aaa====
5340 ==b==
5341 ===ba===
5342 ===bb===
5343 ====bba====
5344 ===bc===
5345 ==c==
5346 ===ca===
5347 !! result
5348 start
5349 ==a==
5350 xxx
5351
5352 ==b==
5353 ===ba===
5354 ===bb===
5355 ====bba====
5356 ===bc===
5357 ==c==
5358 ===ca===
5359 !! end
5360
5361 !! test
5362 Section replacement test (section 3)
5363 !! options
5364 replace=3,"xxx"
5365 !! input
5366 start
5367 ==a==
5368 ===aa===
5369 ====aaa====
5370 ==b==
5371 ===ba===
5372 ===bb===
5373 ====bba====
5374 ===bc===
5375 ==c==
5376 ===ca===
5377 !! result
5378 start
5379 ==a==
5380 ===aa===
5381 xxx
5382
5383 ==b==
5384 ===ba===
5385 ===bb===
5386 ====bba====
5387 ===bc===
5388 ==c==
5389 ===ca===
5390 !! end
5391
5392 !! test
5393 Section replacement test (section 4)
5394 !! options
5395 replace=4,"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 start
5410 ==a==
5411 ===aa===
5412 ====aaa====
5413 xxx
5414
5415 ==c==
5416 ===ca===
5417 !! end
5418
5419 !! test
5420 Section replacement test (section 5)
5421 !! options
5422 replace=5,"xxx"
5423 !! input
5424 start
5425 ==a==
5426 ===aa===
5427 ====aaa====
5428 ==b==
5429 ===ba===
5430 ===bb===
5431 ====bba====
5432 ===bc===
5433 ==c==
5434 ===ca===
5435 !! result
5436 start
5437 ==a==
5438 ===aa===
5439 ====aaa====
5440 ==b==
5441 xxx
5442
5443 ===bb===
5444 ====bba====
5445 ===bc===
5446 ==c==
5447 ===ca===
5448 !! end
5449
5450 !! test
5451 Section replacement test (section 6)
5452 !! options
5453 replace=6,"xxx"
5454 !! input
5455 start
5456 ==a==
5457 ===aa===
5458 ====aaa====
5459 ==b==
5460 ===ba===
5461 ===bb===
5462 ====bba====
5463 ===bc===
5464 ==c==
5465 ===ca===
5466 !! result
5467 start
5468 ==a==
5469 ===aa===
5470 ====aaa====
5471 ==b==
5472 ===ba===
5473 xxx
5474
5475 ===bc===
5476 ==c==
5477 ===ca===
5478 !! end
5479
5480 !! test
5481 Section replacement test (section 7)
5482 !! options
5483 replace=7,"xxx"
5484 !! input
5485 start
5486 ==a==
5487 ===aa===
5488 ====aaa====
5489 ==b==
5490 ===ba===
5491 ===bb===
5492 ====bba====
5493 ===bc===
5494 ==c==
5495 ===ca===
5496 !! result
5497 start
5498 ==a==
5499 ===aa===
5500 ====aaa====
5501 ==b==
5502 ===ba===
5503 ===bb===
5504 xxx
5505
5506 ===bc===
5507 ==c==
5508 ===ca===
5509 !! end
5510
5511 !! test
5512 Section replacement test (section 8)
5513 !! options
5514 replace=8,"xxx"
5515 !! input
5516 start
5517 ==a==
5518 ===aa===
5519 ====aaa====
5520 ==b==
5521 ===ba===
5522 ===bb===
5523 ====bba====
5524 ===bc===
5525 ==c==
5526 ===ca===
5527 !! result
5528 start
5529 ==a==
5530 ===aa===
5531 ====aaa====
5532 ==b==
5533 ===ba===
5534 ===bb===
5535 ====bba====
5536 xxx
5537
5538 ==c==
5539 ===ca===
5540 !!end
5541
5542 !! test
5543 Section replacement test (section 9)
5544 !! options
5545 replace=9,"xxx"
5546 !! input
5547 start
5548 ==a==
5549 ===aa===
5550 ====aaa====
5551 ==b==
5552 ===ba===
5553 ===bb===
5554 ====bba====
5555 ===bc===
5556 ==c==
5557 ===ca===
5558 !! result
5559 start
5560 ==a==
5561 ===aa===
5562 ====aaa====
5563 ==b==
5564 ===ba===
5565 ===bb===
5566 ====bba====
5567 ===bc===
5568 xxx
5569 !! end
5570
5571 !! test
5572 Section replacement test (section 10)
5573 !! options
5574 replace=10,"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 ===bb===
5595 ====bba====
5596 ===bc===
5597 ==c==
5598 xxx
5599 !! end
5600
5601
5602 !! test
5603 Section extraction, HTML headings not at line boundaries (section 0)
5604 !! options
5605 section=0
5606 !! input
5607 <h2>Evil</h2><i>blah blah blah</i>
5608
5609 evil blah
5610
5611 <h2>Nice</h2>
5612
5613 nice blah
5614
5615 <i>extra evil</i><h2>Extra nasty</h2>
5616
5617 extra nasty
5618 !! result
5619 !! end
5620
5621 !! test
5622 Section extraction, HTML headings not at line boundaries (section 1)
5623 !! options
5624 section=1
5625 !! input
5626 <h2>Evil</h2><i>blah blah blah</i>
5627
5628 evil blah
5629
5630 <h2>Nice</h2>
5631
5632 nice blah
5633
5634 <i>extra evil</i><h2>Extra nasty</h2>
5635
5636 extra nasty
5637 !! result
5638 <h2>Evil</h2><i>blah blah blah</i>
5639
5640 evil blah
5641 !! end
5642
5643 !! test
5644 Section extraction, HTML headings not at line boundaries (section 2)
5645 !! options
5646 section=2
5647 !! input
5648 <h2>Evil</h2><i>blah blah blah</i>
5649
5650 evil blah
5651
5652 <h2>Nice</h2>
5653
5654 nice blah
5655
5656 <i>extra evil</i><h2>Extra nasty</h2>
5657
5658 extra nasty
5659 !! result
5660 <h2>Nice</h2>
5661
5662 nice blah
5663
5664 <i>extra evil</i>
5665 !! end
5666
5667 !! test
5668 Section extraction, HTML headings not at line boundaries (section 3)
5669 !! options
5670 section=3
5671 !! input
5672 <h2>Evil</h2><i>blah blah blah</i>
5673
5674 evil blah
5675
5676 <h2>Nice</h2>
5677
5678 nice blah
5679
5680 <i>extra evil</i><h2>Extra nasty</h2>
5681
5682 extra nasty
5683 !! result
5684 <h2>Extra nasty</h2>
5685
5686 extra nasty
5687 !! end
5688
5689
5690 !! test
5691 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5692 !! options
5693 section=1
5694 !! input
5695 ==a==
5696 a
5697 !! result
5698 ==a==
5699 a
5700 !! end
5701
5702 !! test
5703 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5704 !! options
5705 section=1
5706 !! input
5707 ==a==
5708 a
5709 !! result
5710 ==a==
5711 a
5712 !! end
5713
5714 !! test
5715 Handling of &#x0A; in URLs
5716 !! input
5717 **irc://&#x0A;a
5718 !! result
5719 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
5720 </li></ul>
5721 </li></ul>
5722
5723 !!end
5724
5725 !! test
5726 TODO: 5 quotes, code coverage +1 line
5727 !! input
5728 '''''
5729 !! result
5730 !! end
5731
5732 !! test
5733 Special:Search page linking.
5734 !! input
5735 {{Special:search}}
5736 !! result
5737 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
5738 </p>
5739 !! end
5740
5741 !! test
5742 Say the magic word
5743 !! input
5744 * {{PAGENAME}}
5745 * {{BASEPAGENAME}}
5746 * {{SUBPAGENAME}}
5747 * {{SUBPAGENAMEE}}
5748 * {{BASEPAGENAME}}
5749 * {{BASEPAGENAMEE}}
5750 * {{TALKPAGENAME}}
5751 * {{TALKPAGENAMEE}}
5752 * {{SUBJECTPAGENAME}}
5753 * {{SUBJECTPAGENAMEE}}
5754 * {{NAMESPACEE}}
5755 * {{NAMESPACE}}
5756 * {{TALKSPACE}}
5757 * {{TALKSPACEE}}
5758 * {{SUBJECTSPACE}}
5759 * {{SUBJECTSPACEE}}
5760 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
5761 !! result
5762 <ul><li> Parser test
5763 </li><li> Parser test
5764 </li><li> Parser test
5765 </li><li> Parser_test
5766 </li><li> Parser test
5767 </li><li> Parser_test
5768 </li><li> Talk:Parser test
5769 </li><li> Talk:Parser_test
5770 </li><li> Parser test
5771 </li><li> Parser_test
5772 </li><li>
5773 </li><li>
5774 </li><li> Talk
5775 </li><li> Talk
5776 </li><li>
5777 </li><li>
5778 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit" class="new" title="Template:Dynamic">Template:Dynamic</a>
5779 </li></ul>
5780
5781 !! end
5782 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
5783
5784 !! test
5785 Gallery
5786 !! input
5787 <gallery>
5788 image1.png |
5789 image2.gif|||||
5790
5791 image3|
5792 image4 |300px| centre
5793 image5.svg| http://///////
5794 [[x|xx]]]]
5795 * image6
5796 </gallery>
5797 !! result
5798 <table class="gallery" cellspacing="0" cellpadding="0">
5799 <tr>
5800 <td><div class="gallerybox" style="width: 150px;">
5801 <div style="height: 152px;">Image1.png</div>
5802 <div class="gallerytext">
5803 </div>
5804 </div></td>
5805 <td><div class="gallerybox" style="width: 150px;">
5806 <div style="height: 152px;">Image2.gif</div>
5807 <div class="gallerytext">
5808 <p>||||
5809 </p>
5810 </div>
5811 </div></td>
5812 <td><div class="gallerybox" style="width: 150px;">
5813 <div style="height: 152px;">Image3</div>
5814 <div class="gallerytext">
5815 </div>
5816 </div></td>
5817 <td><div class="gallerybox" style="width: 150px;">
5818 <div style="height: 152px;">Image4</div>
5819 <div class="gallerytext">
5820 <p>300px| centre
5821 </p>
5822 </div>
5823 </div></td>
5824 </tr>
5825 <tr>
5826 <td><div class="gallerybox" style="width: 150px;">
5827 <div style="height: 152px;">Image5.svg</div>
5828 <div class="gallerytext">
5829 <pre><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
5830 </pre>
5831 </div>
5832 </div></td>
5833 <td><div class="gallerybox" style="width: 150px;">
5834 <div style="height: 152px;">* image6</div>
5835 <div class="gallerytext">
5836 </div>
5837 </div></td>
5838 </tr>
5839 !! end
5840
5841 !! test
5842 HTML Hex character encoding (spells the word "JavaScript")
5843 !! input
5844 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
5845 !! result
5846 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
5847 </p>
5848 !! end
5849
5850 !! test
5851 __FORCETOC__ override
5852 !! input
5853 __NEWSECTIONLINK__
5854 __FORCETOC__
5855 !! result
5856 <p><br />
5857 </p>
5858 !! end
5859
5860 !! test
5861 ISBN code coverage
5862 !! input
5863 ISBN 978-0-1234-56&#x20;789
5864 !! result
5865 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
5866 </p>
5867 !! end
5868
5869 !! test
5870 ISBN followed by 5 spaces
5871 !! input
5872 ISBN
5873 !! result
5874 <p>ISBN
5875 </p>
5876 !! end
5877
5878 !! test
5879 Double ISBN
5880 !! input
5881 ISBN ISBN 1234567890
5882 !! result
5883 <p>ISBN <a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
5884 </p>
5885 !! end
5886
5887 !! test
5888 Double RFC
5889 !! input
5890 RFC RFC 1234
5891 !! result
5892 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external" title="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
5893 </p>
5894 !! end
5895
5896 !! test
5897 Double RFC with a wiki link
5898 !! input
5899 RFC [[RFC 1234]]
5900 !! result
5901 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit" class="new" title="RFC 1234">RFC 1234</a>
5902 </p>
5903 !! end
5904
5905 !! test
5906 RFC code coverage
5907 !! input
5908 RFC 983&#x20;987
5909 !! result
5910 <p><a href="http://tools.ietf.org/html/rfc983" class="external" title="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
5911 </p>
5912 !! end
5913
5914 !! test
5915 Centre-aligned image
5916 !! input
5917 [[Image:foobar.jpg|centre]]
5918 !! result
5919 <div class="center"><div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div></div>
5920
5921 !!end
5922
5923 !! test
5924 None-aligned image
5925 !! input
5926 [[Image:foobar.jpg|none]]
5927 !! result
5928 <div class="floatnone"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/3/3a/Foobar.jpg" alt="" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
5929
5930 !!end
5931
5932 !! test
5933 Width + Height sized image (using px) (height is ignored)
5934 !! input
5935 [[Image:foobar.jpg|640x480px]]
5936 !! result
5937 <p><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" alt="" width="640" height="73" longdesc="/wiki/Image:Foobar.jpg" /></a>
5938 </p>
5939 !!end
5940
5941 !! test
5942 Another italics / bold test
5943 !! input
5944 ''' ''x'
5945 !! result
5946 <pre>'<i> </i>x'
5947 </pre>
5948 !!end
5949
5950 # Note the results may be incorrect, as parserTest output included this:
5951 # XML error: Mismatched tag at byte 6120:
5952 # ...<dd> </dt></dl> </dd...
5953 !! test
5954 TODO: dt/dd/dl test
5955 !! input
5956 :;;;::
5957 !! result
5958 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
5959 </dd></dl>
5960 </dd></dl>
5961 </dt></dl>
5962 </dt></dl>
5963 </dt></dl>
5964 </dd></dl>
5965
5966 !!end
5967
5968
5969 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
5970 !! test
5971 TODO: Images with the "|" character in the comment
5972 !! input
5973 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
5974 !! result
5975 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="An external URL"><img src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="An external URL" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" 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>
5976
5977 !!end
5978
5979 !! test
5980 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
5981 !! input
5982 <html><script>alert(1);</script></html>
5983 !! result
5984 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
5985 </p>
5986 !! end
5987
5988 !! test
5989 HTML with raw HTML ($wgRawHtml==true)
5990 !! options
5991 rawhtml
5992 !! input
5993 <html><script>alert(1);</script></html>
5994 !! result
5995 <p><script>alert(1);</script>
5996 </p>
5997 !! end
5998
5999 !! test
6000 Parents of subpages, one level up
6001 !! options
6002 subpage title=[[Subpage test/L1/L2/L3]]
6003 !! input
6004 [[../|L2]]
6005 !! result
6006 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit" class="new" title="Subpage test/L1/L2">L2</a>
6007 </p>
6008 !! end
6009
6010
6011 !! test
6012 Parents of subpages, one level up, not named
6013 !! options
6014 subpage title=[[Subpage test/L1/L2/L3]]
6015 !! input
6016 [[../]]
6017 !! result
6018 <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>
6019 </p>
6020 !! end
6021
6022
6023
6024 !! test
6025 Parents of subpages, two levels up
6026 !! options
6027 disabled
6028 subpage title=[[Subpage test/L1/L2/L3]]
6029 !! input
6030 [[../../|L1]]2
6031 !! result
6032 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">L1</a>
6033 </p>
6034 !! end
6035
6036
6037 # Question: should result be "/index.php?title=Subpage_test/L1&amp;action=edit" instead?
6038 !! test
6039 TODO: Parents of subpages, two levels up, without trailing slash or name.
6040 !! options
6041 subpage title=[[Subpage test/L1/L2/L3]]
6042 !! input
6043 [[../..]]
6044 !! result
6045 <p><a href="/index.php?title=Subpage_test/L1/L2/..&amp;action=edit" class="new" title="Subpage test/L1">../..</a>
6046 </p>
6047 !! end
6048
6049 # Question: Why should the link text in the above test be "../..", yet in this test the "../.." part is silently dropped?
6050 # Current result: <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit" class="new" title="Subpage test/L1////">///
6051 !! test
6052 TODO: Parents of subpages, two levels up, with lots of extra trailing slashes.
6053 !! options
6054 subpage title=[[Subpage test/L1/L2/L3]]
6055 !! input
6056 [[../../////]]
6057 !! result
6058 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">Subpage test/L1</a>
6059 </p>
6060 !! end
6061
6062 !! test
6063 Definition list code coverage
6064 !! input
6065 ; title : def
6066 ; title : def
6067 ;title: def
6068 !! result
6069 <dl><dt> title &nbsp;</dt><dd> def
6070 </dd><dt> title&nbsp;</dt><dd> def
6071 </dd><dt>title</dt><dd> def
6072 </dd></dl>
6073
6074 !! end
6075
6076 !! test
6077 TODO: Don't fall for the self-closing div
6078 !! input
6079 <div>hello world</div/>
6080 !! result
6081 <div>hello world</div>
6082
6083 !! end
6084
6085 !! test
6086 MSGNW magic word
6087 !! input
6088 {{MSGNW:msg}}
6089 !! result
6090 <p>&#91;&#91;:Template:Msg]]
6091 </p>
6092 !! end
6093
6094 !! test
6095 RAW magic word
6096 !! input
6097 {{RAW:QUERTY}}
6098 !! result
6099 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit" class="new" title="Template:QUERTY">Template:QUERTY</a>
6100 </p>
6101 !! end
6102
6103 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6104 !! test
6105 Always escape literal '>' in output, not just after '<'
6106 !! input
6107 ><>
6108 !! result
6109 <p>&gt;&lt;&gt;
6110 </p>
6111 !! end
6112
6113 !! test
6114 Template caching
6115 !! input
6116 {{Test}}
6117 {{Test}}
6118 !! result
6119 <p>This is a test template
6120 This is a test template
6121 </p>
6122 !! end
6123
6124
6125 !! article
6126 MediaWiki:Fake
6127 !! text
6128 ==header==
6129 !! endarticle
6130
6131 !! test
6132 Inclusion of !userCanEdit() content
6133 !! input
6134 {{MediaWiki:Fake}}
6135 !! result
6136 <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>
6137
6138 !! end
6139
6140
6141 !! test
6142 Out-of-order TOC heading levels
6143 !! input
6144 ==2==
6145 ======6======
6146 ===3===
6147 =1=
6148 =====5=====
6149 ==2==
6150 !! result
6151 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6152 <ul>
6153 <li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6154 <ul>
6155 <li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6156 <li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6157 </ul>
6158 </li>
6159 <li class="toclevel-1"><a href="#1_7"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6160 <ul>
6161 <li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6162 <li class="toclevel-2"><a href="#2_4"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6163 </ul>
6164 </li>
6165 </ul>
6166 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6167 <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>
6168 <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>
6169 <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>
6170 <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>
6171 <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>
6172 <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>
6173
6174 !! end
6175
6176
6177 !! test
6178 ISBN with a dummy number
6179 !! input
6180 ISBN ---
6181 !! result
6182 <p>ISBN ---
6183 </p>
6184 !! end
6185
6186
6187 !! test
6188 ISBN with space-delimited number
6189 !! input
6190 ISBN 92 9017 032 8
6191 !! result
6192 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9290170328" class="internal">ISBN 92 9017 032 8</a>
6193 </p>
6194 !! end
6195
6196
6197 !! test
6198 ISBN with multiple spaces, no number
6199 !! input
6200 ISBN foo
6201 !! result
6202 <p>ISBN foo
6203 </p>
6204 !! end
6205
6206
6207 !! test
6208 ISBN length
6209 !! input
6210 ISBN 123456789
6211
6212 ISBN 1234567890
6213
6214 ISBN 12345678901
6215 !! result
6216 <p>ISBN 123456789
6217 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
6218 </p><p>ISBN 12345678901
6219 </p>
6220 !! end
6221
6222
6223 !! test
6224 ISBN with trailing year (bug 8110)
6225 !! input
6226 ISBN 1-234-56789-0 - 2006
6227
6228 ISBN 1 234 56789 0 - 2006
6229 !! result
6230 <p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6231 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6232 </p>
6233 !! end
6234
6235
6236 !! test
6237 Pages in namespace (Magic word disabled currently)
6238 !! input
6239 {{PAGESINNAMESPACE:}}
6240 !! result
6241
6242 !! end
6243
6244
6245 !! test
6246 anchorencode
6247 !! input
6248 {{anchorencode:foo bar©#%n}}
6249 !! result
6250 <p>foo_bar.C2.A9.23.25n
6251 </p>
6252 !! end
6253
6254
6255 !! test
6256 Bug 8293: Use of center tag ruins paragraph formatting
6257 !! input
6258 <center>
6259 foo
6260 </center>
6261
6262 bar
6263
6264 baz
6265 !! result
6266 <center>
6267 <p>foo
6268 </p>
6269 </center>
6270 <p>bar
6271 </p>
6272 <pre>baz
6273 </pre>
6274 !! end
6275
6276
6277 ###
6278 ### Language variants related tests
6279 ###
6280 !! test
6281 Self-link in language variants
6282 !! options
6283 title=[[Dunav]] language=sr
6284 !! input
6285 Both [[Dunav]] and [[Дунав]] are names for this river.
6286 !! result
6287 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6288 </p>
6289 !!end
6290
6291
6292 !! test
6293 Link to pages in language variants
6294 !! options
6295 language=sr
6296 !! input
6297 Main Page can be written as [[Маин Паге]]
6298 !! result
6299 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6300 </p>
6301 !!end
6302
6303
6304 !! test
6305 Multiple links to pages in language variants
6306 !! options
6307 language=sr
6308 !! input
6309 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6310 !! result
6311 <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>.
6312 </p>
6313 !!end
6314
6315
6316 !! test
6317 Simple template in language variants
6318 !! options
6319 language=sr
6320 !! input
6321 {{тест}}
6322 !! result
6323 <p>This is a test template
6324 </p>
6325 !! end
6326
6327
6328 !! test
6329 Template with explicit namespace in language variants
6330 !! options
6331 language=sr
6332 !! input
6333 {{Template:тест}}
6334 !! result
6335 <p>This is a test template
6336 </p>
6337 !! end
6338
6339
6340 !! test
6341 Basic test for template parameter in language variants
6342 !! options
6343 language=sr
6344 !! input
6345 {{парамтест|param=foo}}
6346 !! result
6347 <p>This is a test template with parameter foo
6348 </p>
6349 !! end
6350
6351
6352 !! test
6353 Simple category in language variants
6354 !! options
6355 language=sr cat
6356 !! input
6357 [[:Category:МедиаWики Усер'с Гуиде]]
6358 !! result
6359 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6360 !! end
6361
6362
6363 !! test
6364 Stripping -{}- tags (language variants)
6365 !! options
6366 language=sr
6367 !! input
6368 Latin proverb: -{Ne nuntium necare}-
6369 !! result
6370 <p>Latin proverb: Ne nuntium necare
6371 </p>
6372 !! end
6373
6374
6375 !! test
6376 Prevent conversion with -{}- tags (language variants)
6377 !! options
6378 language=sr variant=sr-ec
6379 !! input
6380 Latinski: -{Ne nuntium necare}-
6381 !! result
6382 <p>Латински: Ne nuntium necare
6383 </p>
6384 !! end
6385
6386
6387 !! test
6388 Prevent conversion of text with -{}- tags (language variants)
6389 !! options
6390 language=sr variant=sr-ec
6391 !! input
6392 Latinski: -{Ne nuntium necare}-
6393 !! result
6394 <p>Латински: Ne nuntium necare
6395 </p>
6396 !! end
6397
6398
6399 !! test
6400 Prevent conversion of links with -{}- tags (language variants)
6401 !! options
6402 language=sr variant=sr-ec
6403 !! input
6404 -{[[Main Page]]}-
6405 !! result
6406 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6407 </p>
6408 !! end
6409
6410
6411 !! test
6412 -{}- tags within headlines (within html for parserConvert())
6413 !! options
6414 language=sr variant=sr-ec
6415 !! input
6416 == -{Naslov}- ==
6417 !! result
6418 <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>
6419
6420 !! end
6421
6422
6423 !! test
6424 Explicit definition of language variant alternatives
6425 !! options
6426 language=zh variant=zh-tw
6427 !! input
6428 -{zh:China;zh-tw:Taiwan}-, not China
6429 !! result
6430 <p>Taiwan, not China
6431 </p>
6432 !! end
6433
6434
6435 !! test
6436 Adding explicit session-wise language variant mapping (A flag)
6437 !! options
6438 language=zh variant=zh-tw
6439 !! input
6440 -{A|zh:China;zh-tw:Taiwan}- is China
6441 !! result
6442 <p>Taiwan is Taiwan
6443 </p>
6444 !! end
6445
6446
6447 !! test
6448 Adding explicit conversion rule for title (T flag)
6449 !! options
6450 language=zh variant=zh-tw
6451 !! input
6452 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6453 !! result
6454 <p>Should be stripped!
6455 </p>
6456 !! end
6457
6458
6459 !! test
6460 Raw output of variant escape tags (R flag)
6461 !! options
6462 language=zh variant=zh-tw
6463 !! input
6464 Raw: -{R|zh:China;zh-tw:Taiwan}-
6465 !! result
6466 <p>Raw: zh:China;zh-tw:Taiwan
6467 </p>
6468 !! end
6469
6470
6471 !! test
6472 Do not convert roman numbers to language variants
6473 !! options
6474 language=sr variant=sr-ec
6475 !! input
6476 Fridrih IV je car.
6477 !! result
6478 <p>Фридрих IV је цар.
6479 </p>
6480 !! end
6481
6482
6483 #
6484 #
6485 #
6486
6487 TODO:
6488 more images
6489 more tables
6490 math
6491 character entities
6492 and much more
6493 Try for 100% code coverage