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