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