Fix regression in use of messages with underscores/spaces; normalize spaces to unders...
[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 Transclusion of MediaWiki message with underscore
4782 !! input
4783 {{MediaWiki:history_short}}
4784 !! result
4785 <p>History
4786 </p>
4787 !! end
4788
4789 !! test
4790 Transclusion of MediaWiki message with space
4791 !! input
4792 {{MediaWiki:history short}}
4793 !! result
4794 <p>History
4795 </p>
4796 !! end
4797
4798 !! test
4799 Invalid header with following text
4800 !! input
4801 = x = y
4802 !! result
4803 <p>= x = y
4804 </p>
4805 !! end
4806
4807
4808 !! test
4809 Section extraction test (section 0)
4810 !! options
4811 section=0
4812 !! input
4813 start
4814 ==a==
4815 ===aa===
4816 ====aaa====
4817 ==b==
4818 ===ba===
4819 ===bb===
4820 ====bba====
4821 ===bc===
4822 ==c==
4823 ===ca===
4824 !! result
4825 start
4826 !! end
4827
4828 !! test
4829 Section extraction test (section 1)
4830 !! options
4831 section=1
4832 !! input
4833 start
4834 ==a==
4835 ===aa===
4836 ====aaa====
4837 ==b==
4838 ===ba===
4839 ===bb===
4840 ====bba====
4841 ===bc===
4842 ==c==
4843 ===ca===
4844 !! result
4845 ==a==
4846 ===aa===
4847 ====aaa====
4848 !! end
4849
4850 !! test
4851 Section extraction test (section 2)
4852 !! options
4853 section=2
4854 !! input
4855 start
4856 ==a==
4857 ===aa===
4858 ====aaa====
4859 ==b==
4860 ===ba===
4861 ===bb===
4862 ====bba====
4863 ===bc===
4864 ==c==
4865 ===ca===
4866 !! result
4867 ===aa===
4868 ====aaa====
4869 !! end
4870
4871 !! test
4872 Section extraction test (section 3)
4873 !! options
4874 section=3
4875 !! input
4876 start
4877 ==a==
4878 ===aa===
4879 ====aaa====
4880 ==b==
4881 ===ba===
4882 ===bb===
4883 ====bba====
4884 ===bc===
4885 ==c==
4886 ===ca===
4887 !! result
4888 ====aaa====
4889 !! end
4890
4891 !! test
4892 Section extraction test (section 4)
4893 !! options
4894 section=4
4895 !! input
4896 start
4897 ==a==
4898 ===aa===
4899 ====aaa====
4900 ==b==
4901 ===ba===
4902 ===bb===
4903 ====bba====
4904 ===bc===
4905 ==c==
4906 ===ca===
4907 !! result
4908 ==b==
4909 ===ba===
4910 ===bb===
4911 ====bba====
4912 ===bc===
4913 !! end
4914
4915 !! test
4916 Section extraction test (section 5)
4917 !! options
4918 section=5
4919 !! input
4920 start
4921 ==a==
4922 ===aa===
4923 ====aaa====
4924 ==b==
4925 ===ba===
4926 ===bb===
4927 ====bba====
4928 ===bc===
4929 ==c==
4930 ===ca===
4931 !! result
4932 ===ba===
4933 !! end
4934
4935 !! test
4936 Section extraction test (section 6)
4937 !! options
4938 section=6
4939 !! input
4940 start
4941 ==a==
4942 ===aa===
4943 ====aaa====
4944 ==b==
4945 ===ba===
4946 ===bb===
4947 ====bba====
4948 ===bc===
4949 ==c==
4950 ===ca===
4951 !! result
4952 ===bb===
4953 ====bba====
4954 !! end
4955
4956 !! test
4957 Section extraction test (section 7)
4958 !! options
4959 section=7
4960 !! input
4961 start
4962 ==a==
4963 ===aa===
4964 ====aaa====
4965 ==b==
4966 ===ba===
4967 ===bb===
4968 ====bba====
4969 ===bc===
4970 ==c==
4971 ===ca===
4972 !! result
4973 ====bba====
4974 !! end
4975
4976 !! test
4977 Section extraction test (section 8)
4978 !! options
4979 section=8
4980 !! input
4981 start
4982 ==a==
4983 ===aa===
4984 ====aaa====
4985 ==b==
4986 ===ba===
4987 ===bb===
4988 ====bba====
4989 ===bc===
4990 ==c==
4991 ===ca===
4992 !! result
4993 ===bc===
4994 !! end
4995
4996 !! test
4997 Section extraction test (section 9)
4998 !! options
4999 section=9
5000 !! input
5001 start
5002 ==a==
5003 ===aa===
5004 ====aaa====
5005 ==b==
5006 ===ba===
5007 ===bb===
5008 ====bba====
5009 ===bc===
5010 ==c==
5011 ===ca===
5012 !! result
5013 ==c==
5014 ===ca===
5015 !! end
5016
5017 !! test
5018 Section extraction test (section 10)
5019 !! options
5020 section=10
5021 !! input
5022 start
5023 ==a==
5024 ===aa===
5025 ====aaa====
5026 ==b==
5027 ===ba===
5028 ===bb===
5029 ====bba====
5030 ===bc===
5031 ==c==
5032 ===ca===
5033 !! result
5034 ===ca===
5035 !! end
5036
5037 !! test
5038 Section extraction test (nonexistent section 11)
5039 !! options
5040 section=11
5041 !! input
5042 start
5043 ==a==
5044 ===aa===
5045 ====aaa====
5046 ==b==
5047 ===ba===
5048 ===bb===
5049 ====bba====
5050 ===bc===
5051 ==c==
5052 ===ca===
5053 !! result
5054 !! end
5055
5056 !! test
5057 Section extraction test with bogus heading (section 1)
5058 !! options
5059 section=1
5060 !! input
5061 ==a==
5062 ==bogus== not a legal section
5063 ==b==
5064 !! result
5065 ==a==
5066 ==bogus== not a legal section
5067 !! end
5068
5069 !! test
5070 Section extraction test with bogus heading (section 2)
5071 !! options
5072 section=2
5073 !! input
5074 ==a==
5075 ==bogus== not a legal section
5076 ==b==
5077 !! result
5078 ==b==
5079 !! end
5080
5081 !! test
5082 Section extraction test with comment after heading (section 1)
5083 !! options
5084 section=1
5085 !! input
5086 ==a==
5087 ==legal== <!-- a legal section -->
5088 ==b==
5089 !! result
5090 ==a==
5091 !! end
5092
5093 !! test
5094 Section extraction test with comment after heading (section 2)
5095 !! options
5096 section=2
5097 !! input
5098 ==a==
5099 ==legal== <!-- a legal section -->
5100 ==b==
5101 !! result
5102 ==legal== <!-- a legal section -->
5103 !! end
5104
5105 !! test
5106 Section extraction test with bogus <nowiki> heading (section 1)
5107 !! options
5108 section=1
5109 !! input
5110 ==a==
5111 ==bogus== <nowiki>not a legal section</nowiki>
5112 ==b==
5113 !! result
5114 ==a==
5115 ==bogus== <nowiki>not a legal section</nowiki>
5116 !! end
5117
5118 !! test
5119 Section extraction test with bogus <nowiki> heading (section 2)
5120 !! options
5121 section=2
5122 !! input
5123 ==a==
5124 ==bogus== <nowiki>not a legal section</nowiki>
5125 ==b==
5126 !! result
5127 ==b==
5128 !! end
5129
5130
5131 !! test
5132 Section extraction prefixed by comment (section 1) (bug 2587)
5133 !! options
5134 section=1
5135 !! input
5136 <!-- -->==sec1==
5137 ==sec2==
5138 !!result
5139 <!-- -->==sec1==
5140 !!end
5141
5142 !! test
5143 Section extraction prefixed by comment (section 2) (bug 2587)
5144 !! options
5145 section=2
5146 !! input
5147 <!-- -->==sec1==
5148 ==sec2==
5149 !!result
5150 ==sec2==
5151 !!end
5152
5153
5154 !! test
5155 Section extraction, mixed wiki and html (section 1) (bug 2607)
5156 !! options
5157 section=1
5158 !! input
5159 <h2>1</h2>
5160 one
5161 ==2==
5162 two
5163 ==3==
5164 three
5165 !! result
5166 <h2>1</h2>
5167 one
5168 !! end
5169
5170 !! test
5171 Section extraction, mixed wiki and html (section 2) (bug 2607)
5172 !! options
5173 section=2
5174 !! input
5175 <h2>1</h2>
5176 one
5177 ==2==
5178 two
5179 ==3==
5180 three
5181 !! result
5182 ==2==
5183 two
5184 !! end
5185
5186
5187 !! test
5188 Section extraction, heading surrounded by <noinclude> (bug 3342)
5189 !! options
5190 section=1
5191 !! input
5192 <noinclude>==a==</noinclude>
5193 text
5194 !! result
5195 <noinclude>==a==</noinclude>
5196 text
5197 !!end
5198
5199
5200 !! test
5201 Section extraction, HTML heading subsections (bug 5272)
5202 !! options
5203 section=1
5204 !! input
5205 <h2>a</h2>
5206 <h3>aa</h3>
5207 <h2>b</h2>
5208 !! result
5209 <h2>a</h2>
5210 <h3>aa</h3>
5211 !! end
5212
5213 !! test
5214 Section extraction, HTML headings should be ignored in extensions (bug 3476)
5215 !! options
5216 section=2
5217 !! input
5218 <h2>a</h2>
5219 <tag>
5220 <h2>not b</h2>
5221 </tag>
5222 <h2>b</h2>
5223 !! result
5224 <h2>b</h2>
5225 !! end
5226
5227 !! test
5228 Section replacement test (section 0)
5229 !! options
5230 replace=0,"xxx"
5231 !! input
5232 start
5233 ==a==
5234 ===aa===
5235 ====aaa====
5236 ==b==
5237 ===ba===
5238 ===bb===
5239 ====bba====
5240 ===bc===
5241 ==c==
5242 ===ca===
5243 !! result
5244 xxx
5245
5246 ==a==
5247 ===aa===
5248 ====aaa====
5249 ==b==
5250 ===ba===
5251 ===bb===
5252 ====bba====
5253 ===bc===
5254 ==c==
5255 ===ca===
5256 !! end
5257
5258 !! test
5259 Section replacement test (section 1)
5260 !! options
5261 replace=1,"xxx"
5262 !! input
5263 start
5264 ==a==
5265 ===aa===
5266 ====aaa====
5267 ==b==
5268 ===ba===
5269 ===bb===
5270 ====bba====
5271 ===bc===
5272 ==c==
5273 ===ca===
5274 !! result
5275 start
5276 xxx
5277
5278 ==b==
5279 ===ba===
5280 ===bb===
5281 ====bba====
5282 ===bc===
5283 ==c==
5284 ===ca===
5285 !! end
5286
5287 !! test
5288 Section replacement test (section 2)
5289 !! options
5290 replace=2,"xxx"
5291 !! input
5292 start
5293 ==a==
5294 ===aa===
5295 ====aaa====
5296 ==b==
5297 ===ba===
5298 ===bb===
5299 ====bba====
5300 ===bc===
5301 ==c==
5302 ===ca===
5303 !! result
5304 start
5305 ==a==
5306 xxx
5307
5308 ==b==
5309 ===ba===
5310 ===bb===
5311 ====bba====
5312 ===bc===
5313 ==c==
5314 ===ca===
5315 !! end
5316
5317 !! test
5318 Section replacement test (section 3)
5319 !! options
5320 replace=3,"xxx"
5321 !! input
5322 start
5323 ==a==
5324 ===aa===
5325 ====aaa====
5326 ==b==
5327 ===ba===
5328 ===bb===
5329 ====bba====
5330 ===bc===
5331 ==c==
5332 ===ca===
5333 !! result
5334 start
5335 ==a==
5336 ===aa===
5337 xxx
5338
5339 ==b==
5340 ===ba===
5341 ===bb===
5342 ====bba====
5343 ===bc===
5344 ==c==
5345 ===ca===
5346 !! end
5347
5348 !! test
5349 Section replacement test (section 4)
5350 !! options
5351 replace=4,"xxx"
5352 !! input
5353 start
5354 ==a==
5355 ===aa===
5356 ====aaa====
5357 ==b==
5358 ===ba===
5359 ===bb===
5360 ====bba====
5361 ===bc===
5362 ==c==
5363 ===ca===
5364 !! result
5365 start
5366 ==a==
5367 ===aa===
5368 ====aaa====
5369 xxx
5370
5371 ==c==
5372 ===ca===
5373 !! end
5374
5375 !! test
5376 Section replacement test (section 5)
5377 !! options
5378 replace=5,"xxx"
5379 !! input
5380 start
5381 ==a==
5382 ===aa===
5383 ====aaa====
5384 ==b==
5385 ===ba===
5386 ===bb===
5387 ====bba====
5388 ===bc===
5389 ==c==
5390 ===ca===
5391 !! result
5392 start
5393 ==a==
5394 ===aa===
5395 ====aaa====
5396 ==b==
5397 xxx
5398
5399 ===bb===
5400 ====bba====
5401 ===bc===
5402 ==c==
5403 ===ca===
5404 !! end
5405
5406 !! test
5407 Section replacement test (section 6)
5408 !! options
5409 replace=6,"xxx"
5410 !! input
5411 start
5412 ==a==
5413 ===aa===
5414 ====aaa====
5415 ==b==
5416 ===ba===
5417 ===bb===
5418 ====bba====
5419 ===bc===
5420 ==c==
5421 ===ca===
5422 !! result
5423 start
5424 ==a==
5425 ===aa===
5426 ====aaa====
5427 ==b==
5428 ===ba===
5429 xxx
5430
5431 ===bc===
5432 ==c==
5433 ===ca===
5434 !! end
5435
5436 !! test
5437 Section replacement test (section 7)
5438 !! options
5439 replace=7,"xxx"
5440 !! input
5441 start
5442 ==a==
5443 ===aa===
5444 ====aaa====
5445 ==b==
5446 ===ba===
5447 ===bb===
5448 ====bba====
5449 ===bc===
5450 ==c==
5451 ===ca===
5452 !! result
5453 start
5454 ==a==
5455 ===aa===
5456 ====aaa====
5457 ==b==
5458 ===ba===
5459 ===bb===
5460 xxx
5461
5462 ===bc===
5463 ==c==
5464 ===ca===
5465 !! end
5466
5467 !! test
5468 Section replacement test (section 8)
5469 !! options
5470 replace=8,"xxx"
5471 !! input
5472 start
5473 ==a==
5474 ===aa===
5475 ====aaa====
5476 ==b==
5477 ===ba===
5478 ===bb===
5479 ====bba====
5480 ===bc===
5481 ==c==
5482 ===ca===
5483 !! result
5484 start
5485 ==a==
5486 ===aa===
5487 ====aaa====
5488 ==b==
5489 ===ba===
5490 ===bb===
5491 ====bba====
5492 xxx
5493
5494 ==c==
5495 ===ca===
5496 !!end
5497
5498 !! test
5499 Section replacement test (section 9)
5500 !! options
5501 replace=9,"xxx"
5502 !! input
5503 start
5504 ==a==
5505 ===aa===
5506 ====aaa====
5507 ==b==
5508 ===ba===
5509 ===bb===
5510 ====bba====
5511 ===bc===
5512 ==c==
5513 ===ca===
5514 !! result
5515 start
5516 ==a==
5517 ===aa===
5518 ====aaa====
5519 ==b==
5520 ===ba===
5521 ===bb===
5522 ====bba====
5523 ===bc===
5524 xxx
5525 !! end
5526
5527 !! test
5528 Section replacement test (section 10)
5529 !! options
5530 replace=10,"xxx"
5531 !! input
5532 start
5533 ==a==
5534 ===aa===
5535 ====aaa====
5536 ==b==
5537 ===ba===
5538 ===bb===
5539 ====bba====
5540 ===bc===
5541 ==c==
5542 ===ca===
5543 !! result
5544 start
5545 ==a==
5546 ===aa===
5547 ====aaa====
5548 ==b==
5549 ===ba===
5550 ===bb===
5551 ====bba====
5552 ===bc===
5553 ==c==
5554 xxx
5555 !! end
5556
5557
5558 !! test
5559 Section extraction, HTML headings not at line boundaries (section 0)
5560 !! options
5561 section=0
5562 !! input
5563 <h2>Evil</h2><i>blah blah blah</i>
5564
5565 evil blah
5566
5567 <h2>Nice</h2>
5568
5569 nice blah
5570
5571 <i>extra evil</i><h2>Extra nasty</h2>
5572
5573 extra nasty
5574 !! result
5575 !! end
5576
5577 !! test
5578 Section extraction, HTML headings not at line boundaries (section 1)
5579 !! options
5580 section=1
5581 !! input
5582 <h2>Evil</h2><i>blah blah blah</i>
5583
5584 evil blah
5585
5586 <h2>Nice</h2>
5587
5588 nice blah
5589
5590 <i>extra evil</i><h2>Extra nasty</h2>
5591
5592 extra nasty
5593 !! result
5594 <h2>Evil</h2><i>blah blah blah</i>
5595
5596 evil blah
5597 !! end
5598
5599 !! test
5600 Section extraction, HTML headings not at line boundaries (section 2)
5601 !! options
5602 section=2
5603 !! input
5604 <h2>Evil</h2><i>blah blah blah</i>
5605
5606 evil blah
5607
5608 <h2>Nice</h2>
5609
5610 nice blah
5611
5612 <i>extra evil</i><h2>Extra nasty</h2>
5613
5614 extra nasty
5615 !! result
5616 <h2>Nice</h2>
5617
5618 nice blah
5619
5620 <i>extra evil</i>
5621 !! end
5622
5623 !! test
5624 Section extraction, HTML headings not at line boundaries (section 3)
5625 !! options
5626 section=3
5627 !! input
5628 <h2>Evil</h2><i>blah blah blah</i>
5629
5630 evil blah
5631
5632 <h2>Nice</h2>
5633
5634 nice blah
5635
5636 <i>extra evil</i><h2>Extra nasty</h2>
5637
5638 extra nasty
5639 !! result
5640 <h2>Extra nasty</h2>
5641
5642 extra nasty
5643 !! end
5644
5645
5646 !! test
5647 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5648 !! options
5649 section=1
5650 !! input
5651 ==a==
5652 a
5653 !! result
5654 ==a==
5655 a
5656 !! end
5657
5658 !! test
5659 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5660 !! options
5661 section=1
5662 !! input
5663 ==a==
5664 a
5665 !! result
5666 ==a==
5667 a
5668 !! end
5669
5670 !! test
5671 Handling of &#x0A; in URLs
5672 !! input
5673 **irc://&#x0A;a
5674 !! result
5675 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
5676 </li></ul>
5677 </li></ul>
5678
5679 !!end
5680
5681 !! test
5682 TODO: 5 quotes, code coverage +1 line
5683 !! input
5684 '''''
5685 !! result
5686 !! end
5687
5688 !! test
5689 Special:Search page linking.
5690 !! input
5691 {{Special:search}}
5692 !! result
5693 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
5694 </p>
5695 !! end
5696
5697 !! test
5698 Say the magic word
5699 !! input
5700 * {{PAGENAME}}
5701 * {{BASEPAGENAME}}
5702 * {{SUBPAGENAME}}
5703 * {{SUBPAGENAMEE}}
5704 * {{BASEPAGENAME}}
5705 * {{BASEPAGENAMEE}}
5706 * {{TALKPAGENAME}}
5707 * {{TALKPAGENAMEE}}
5708 * {{SUBJECTPAGENAME}}
5709 * {{SUBJECTPAGENAMEE}}
5710 * {{NAMESPACEE}}
5711 * {{NAMESPACE}}
5712 * {{TALKSPACE}}
5713 * {{TALKSPACEE}}
5714 * {{SUBJECTSPACE}}
5715 * {{SUBJECTSPACEE}}
5716 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
5717 !! result
5718 <ul><li> Parser test
5719 </li><li> Parser test
5720 </li><li> Parser test
5721 </li><li> Parser_test
5722 </li><li> Parser test
5723 </li><li> Parser_test
5724 </li><li> Talk:Parser test
5725 </li><li> Talk:Parser_test
5726 </li><li> Parser test
5727 </li><li> Parser_test
5728 </li><li>
5729 </li><li>
5730 </li><li> Talk
5731 </li><li> Talk
5732 </li><li>
5733 </li><li>
5734 </li><li> <a href="/index.php?title=Template:Dynamic&amp;action=edit" class="new" title="Template:Dynamic">Template:Dynamic</a>
5735 </li></ul>
5736
5737 !! end
5738 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
5739
5740 !! test
5741 Gallery
5742 !! input
5743 <gallery>
5744 image1.png |
5745 image2.gif|||||
5746
5747 image3|
5748 image4 |300px| centre
5749 image5.svg| http://///////
5750 [[x|xx]]]]
5751 * image6
5752 </gallery>
5753 !! result
5754 <table class="gallery" cellspacing="0" cellpadding="0"><tr><td><div class="gallerybox"><div style="height: 152px;">Image1.png</div><div class="gallerytext">
5755 </div></div></td>
5756 <td><div class="gallerybox"><div style="height: 152px;">Image2.gif</div><div class="gallerytext">
5757 ||||</div></div></td>
5758 <td><div class="gallerybox"><div style="height: 152px;">Image3</div><div class="gallerytext">
5759 </div></div></td>
5760 <td><div class="gallerybox"><div style="height: 152px;">Image4</div><div class="gallerytext">
5761 300px| centre</div></div></td>
5762 </tr><tr><td><div class="gallerybox"><div style="height: 152px;">Image5.svg</div><div class="gallerytext">
5763 <a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a></div></div></td>
5764 <td><div class="gallerybox"><div style="height: 152px;">* image6</div><div class="gallerytext">
5765 </div></div></td>
5766 </tr>
5767 </table>
5768
5769 !! end
5770
5771 !! test
5772 HTML Hex character encoding (spells the word "JavaScript")
5773 !! input
5774 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
5775 !! result
5776 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
5777 </p>
5778 !! end
5779
5780 !! test
5781 __FORCETOC__ override
5782 !! input
5783 __NEWSECTIONLINK__
5784 __FORCETOC__
5785 !! result
5786 <p><br />
5787 </p>
5788 !! end
5789
5790 !! test
5791 ISBN code coverage
5792 !! input
5793 ISBN 978-0-1234-56&#x20;789
5794 !! result
5795 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
5796 </p>
5797 !! end
5798
5799 !! test
5800 ISBN followed by 5 spaces
5801 !! input
5802 ISBN
5803 !! result
5804 <p>ISBN
5805 </p>
5806 !! end
5807
5808 !! test
5809 Double ISBN
5810 !! input
5811 ISBN ISBN 1234567890
5812 !! result
5813 <p>ISBN <a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
5814 </p>
5815 !! end
5816
5817 !! test
5818 Double RFC
5819 !! input
5820 RFC RFC 1234
5821 !! result
5822 <p>RFC <a href="http://www.ietf.org/rfc/rfc1234.txt" class="external" title="http://www.ietf.org/rfc/rfc1234.txt">RFC 1234</a>
5823 </p>
5824 !! end
5825
5826 !! test
5827 Double RFC with a wiki link
5828 !! input
5829 RFC [[RFC 1234]]
5830 !! result
5831 <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit" class="new" title="RFC 1234">RFC 1234</a>
5832 </p>
5833 !! end
5834
5835 !! test
5836 RFC code coverage
5837 !! input
5838 RFC 983&#x20;987
5839 !! result
5840 <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
5841 </p>
5842 !! end
5843
5844 !! test
5845 Centre-aligned image
5846 !! input
5847 [[Image:foobar.jpg|centre]]
5848 !! result
5849 <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>
5850
5851 !!end
5852
5853 !! test
5854 None-aligned image
5855 !! input
5856 [[Image:foobar.jpg|none]]
5857 !! result
5858 <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>
5859
5860 !!end
5861
5862 !! test
5863 Width + Height sized image (using px) (height is ignored)
5864 !! input
5865 [[Image:foobar.jpg|640x480px]]
5866 !! result
5867 <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>
5868 </p>
5869 !!end
5870
5871 !! test
5872 Another italics / bold test
5873 !! input
5874 ''' ''x'
5875 !! result
5876 <pre>'<i> </i>x'
5877 </pre>
5878 !!end
5879
5880 # Note the results may be incorrect, as parserTest output included this:
5881 # XML error: Mismatched tag at byte 6120:
5882 # ...<dd> </dt></dl> </dd...
5883 !! test
5884 TODO: dt/dd/dl test
5885 !! input
5886 :;;;::
5887 !! result
5888 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
5889 </dt></dl>
5890 </dd></dl>
5891 </dd></dl>
5892 </dd></dl>
5893 </dd></dl>
5894 </dd></dl>
5895
5896 !!end
5897
5898
5899 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
5900 !! test
5901 TODO: Images with the "|" character in the comment
5902 !! input
5903 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
5904 !! result
5905 <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>
5906
5907 !!end
5908
5909 !! test
5910 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
5911 !! input
5912 <html><script>alert(1);</script></html>
5913 !! result
5914 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
5915 </p>
5916 !! end
5917
5918 !! test
5919 HTML with raw HTML ($wgRawHtml==true)
5920 !! options
5921 rawhtml
5922 !! input
5923 <html><script>alert(1);</script></html>
5924 !! result
5925 <p><script>alert(1);</script>
5926 </p>
5927 !! end
5928
5929 !! test
5930 Parents of subpages, one level up
5931 !! options
5932 subpage title=[[Subpage test/L1/L2/L3]]
5933 !! input
5934 [[../|L2]]
5935 !! result
5936 <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit" class="new" title="Subpage test/L1/L2">L2</a>
5937 </p>
5938 !! end
5939
5940
5941 !! test
5942 Parents of subpages, one level up, not named
5943 !! options
5944 subpage title=[[Subpage test/L1/L2/L3]]
5945 !! input
5946 [[../]]
5947 !! result
5948 <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>
5949 </p>
5950 !! end
5951
5952
5953
5954 !! test
5955 Parents of subpages, two levels up
5956 !! options
5957 disabled
5958 subpage title=[[Subpage test/L1/L2/L3]]
5959 !! input
5960 [[../../|L1]]2
5961 !! result
5962 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">L1</a>
5963 </p>
5964 !! end
5965
5966
5967 # Question: should result be "/index.php?title=Subpage_test/L1&amp;action=edit" instead?
5968 !! test
5969 TODO: Parents of subpages, two levels up, without trailing slash or name.
5970 !! options
5971 subpage title=[[Subpage test/L1/L2/L3]]
5972 !! input
5973 [[../..]]
5974 !! result
5975 <p><a href="/index.php?title=Subpage_test/L1/L2/..&amp;action=edit" class="new" title="Subpage test/L1">../..</a>
5976 </p>
5977 !! end
5978
5979 # Question: Why should the link text in the above test be "../..", yet in this test the "../.." part is silently dropped?
5980 # Current result: <p><a href="/index.php?title=Subpage_test/L1////&amp;action=edit" class="new" title="Subpage test/L1////">///
5981 !! test
5982 TODO: Parents of subpages, two levels up, with lots of extra trailing slashes.
5983 !! options
5984 subpage title=[[Subpage test/L1/L2/L3]]
5985 !! input
5986 [[../../////]]
5987 !! result
5988 <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit" class="new" title="Subpage test/L1">Subpage test/L1</a>
5989 </p>
5990 !! end
5991
5992 !! test
5993 Definition list code coverage
5994 !! input
5995 ; title : def
5996 ; title : def
5997 ;title: def
5998 !! result
5999 <dl><dt> title &nbsp;</dt><dd> def
6000 </dd><dt> title&nbsp;</dt><dd> def
6001 </dd><dt>title</dt><dd> def
6002 </dd></dl>
6003
6004 !! end
6005
6006 !! test
6007 TODO: Don't fall for the self-closing div
6008 !! input
6009 <div>hello world</div/>
6010 !! result
6011 <div>hello world</div>
6012
6013 !! end
6014
6015 !! test
6016 MSGNW magic word
6017 !! input
6018 {{MSGNW:msg}}
6019 !! result
6020 <p>&#91;&#91;:Template:Msg]]
6021 </p>
6022 !! end
6023
6024 !! test
6025 RAW magic word
6026 !! input
6027 {{RAW:QUERTY}}
6028 !! result
6029 <p><a href="/index.php?title=Template:QUERTY&amp;action=edit" class="new" title="Template:QUERTY">Template:QUERTY</a>
6030 </p>
6031 !! end
6032
6033 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6034 !! test
6035 TODO: Always escape literal '>' in output, not just after '<'
6036 !! input
6037 ><>
6038 !! result
6039 <p>&gt;&lt;&gt;
6040 </p>
6041 !! end
6042
6043 !! test
6044 Template caching
6045 !! input
6046 {{Test}}
6047 {{Test}}
6048 !! result
6049 <p>This is a test template
6050 This is a test template
6051 </p>
6052 !! end
6053
6054
6055 !! article
6056 MediaWiki:Fake
6057 !! text
6058 ==header==
6059 !! endarticle
6060
6061 !! test
6062 Inclusion of !userCanEdit() content
6063 !! input
6064 {{MediaWiki:Fake}}
6065 !! result
6066 <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>
6067
6068 !! end
6069
6070
6071 !! test
6072 Out-of-order TOC heading levels
6073 !! input
6074 ==2==
6075 ======6======
6076 ===3===
6077 =1=
6078 =====5=====
6079 ==2==
6080 !! result
6081 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6082 <ul>
6083 <li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6084 <ul>
6085 <li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6086 <li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6087 </ul>
6088 </li>
6089 <li class="toclevel-1"><a href="#1_7"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6090 <ul>
6091 <li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6092 <li class="toclevel-2"><a href="#2_4"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6093 </ul>
6094 </li>
6095 </ul>
6096 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6097 <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>
6098 <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>
6099 <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>
6100 <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>
6101 <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>
6102 <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>
6103
6104 !! end
6105
6106
6107 !! test
6108 ISBN with a dummy number
6109 !! input
6110 ISBN ---
6111 !! result
6112 <p>ISBN ---
6113 </p>
6114 !! end
6115
6116
6117 !! test
6118 ISBN with space-delimited number
6119 !! input
6120 ISBN 92 9017 032 8
6121 !! result
6122 <p><a href="/index.php?title=Special:Booksources&amp;isbn=9290170328" class="internal">ISBN 92 9017 032 8</a>
6123 </p>
6124 !! end
6125
6126
6127 !! test
6128 ISBN with multiple spaces, no number
6129 !! input
6130 ISBN foo
6131 !! result
6132 <p>ISBN foo
6133 </p>
6134 !! end
6135
6136
6137 !! test
6138 ISBN length
6139 !! input
6140 ISBN 123456789
6141
6142 ISBN 1234567890
6143
6144 ISBN 12345678901
6145 !! result
6146 <p>ISBN 123456789
6147 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1234567890</a>
6148 </p><p>ISBN 12345678901
6149 </p>
6150 !! end
6151
6152
6153 !! test
6154 ISBN with trailing year (bug 8110)
6155 !! input
6156 ISBN 1-234-56789-0 - 2006
6157
6158 ISBN 1 234 56789 0 - 2006
6159 !! result
6160 <p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6161 </p><p><a href="/index.php?title=Special:Booksources&amp;isbn=1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6162 </p>
6163 !! end
6164
6165
6166 !! test
6167 Pages in namespace (Magic word disabled currently)
6168 !! input
6169 {{PAGESINNAMESPACE:}}
6170 !! result
6171
6172 !! end
6173
6174
6175 !! test
6176 anchorencode
6177 !! input
6178 {{anchorencode:foo bar©#%n}}
6179 !! result
6180 <p>foo_bar.C2.A9.23.25n
6181 </p>
6182 !! end
6183
6184
6185 !! test
6186 Bug 8293: Use of center tag ruins paragraph formatting
6187 !! input
6188 <center>
6189 foo
6190 </center>
6191
6192 bar
6193
6194 baz
6195 !! result
6196 <center>
6197 <p>foo
6198 </p>
6199 </center>
6200 <p>bar
6201 </p>
6202 <pre>baz
6203 </pre>
6204 !! end
6205
6206
6207 ###
6208 ### Language variants related tests
6209 ###
6210 !! test
6211 Self-link in language variants
6212 !! options
6213 title=[[Dunav]] language=sr
6214 !! input
6215 Both [[Dunav]] and [[Дунав]] are names for this river.
6216 !! result
6217 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6218 </p>
6219 !!end
6220
6221
6222 !! test
6223 Link to pages in language variants
6224 !! options
6225 language=sr
6226 !! input
6227 Main Page can be written as [[Маин Паге]]
6228 !! result
6229 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6230 </p>
6231 !!end
6232
6233
6234 !! test
6235 Multiple links to pages in language variants
6236 !! options
6237 language=sr
6238 !! input
6239 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6240 !! result
6241 <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>.
6242 </p>
6243 !!end
6244
6245
6246 !! test
6247 Simple template in language variants
6248 !! options
6249 language=sr
6250 !! input
6251 {{тест}}
6252 !! result
6253 <p>This is a test template
6254 </p>
6255 !! end
6256
6257
6258 !! test
6259 Template with explicit namespace in language variants
6260 !! options
6261 language=sr
6262 !! input
6263 {{Template:тест}}
6264 !! result
6265 <p>This is a test template
6266 </p>
6267 !! end
6268
6269
6270 !! test
6271 Basic test for template parameter in language variants
6272 !! options
6273 language=sr
6274 !! input
6275 {{парамтест|param=foo}}
6276 !! result
6277 <p>This is a test template with parameter foo
6278 </p>
6279 !! end
6280
6281
6282 !! test
6283 Simple category in language variants
6284 !! options
6285 language=sr cat
6286 !! input
6287 [[:Category:МедиаWики Усер'с Гуиде]]
6288 !! result
6289 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
6290 !! end
6291
6292
6293 !! test
6294 Stripping -{}- tags (language variants)
6295 !! options
6296 language=sr
6297 !! input
6298 Latin proverb: -{Ne nuntium necare}-
6299 !! result
6300 <p>Latin proverb: Ne nuntium necare
6301 </p>
6302 !! end
6303
6304
6305 !! test
6306 Prevent conversion with -{}- tags (language variants)
6307 !! options
6308 language=sr variant=sr-ec
6309 !! input
6310 Latinski: -{Ne nuntium necare}-
6311 !! result
6312 <p>Латински: Ne nuntium necare
6313 </p>
6314 !! end
6315
6316
6317 !! test
6318 Prevent conversion of text with -{}- tags (language variants)
6319 !! options
6320 language=sr variant=sr-ec
6321 !! input
6322 Latinski: -{Ne nuntium necare}-
6323 !! result
6324 <p>Латински: Ne nuntium necare
6325 </p>
6326 !! end
6327
6328
6329 !! test
6330 Prevent conversion of links with -{}- tags (language variants)
6331 !! options
6332 language=sr variant=sr-ec
6333 !! input
6334 -{[[Main Page]]}-
6335 !! result
6336 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6337 </p>
6338 !! end
6339
6340
6341 !! test
6342 -{}- tags within headlines (within html for parserConvert())
6343 !! options
6344 language=sr variant=sr-ec
6345 !! input
6346 == -{Naslov}- ==
6347 !! result
6348 <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>
6349
6350 !! end
6351
6352
6353 !! test
6354 Explicit definition of language variant alternatives
6355 !! options
6356 language=zh variant=zh-tw
6357 !! input
6358 -{zh:China;zh-tw:Taiwan}-, not China
6359 !! result
6360 <p>Taiwan, not China
6361 </p>
6362 !! end
6363
6364
6365 !! test
6366 Adding explicit session-wise language variant mapping (A flag)
6367 !! options
6368 language=zh variant=zh-tw
6369 !! input
6370 -{A|zh:China;zh-tw:Taiwan}- is China
6371 !! result
6372 <p>Taiwan is Taiwan
6373 </p>
6374 !! end
6375
6376
6377 !! test
6378 Adding explicit conversion rule for title (T flag)
6379 !! options
6380 language=zh variant=zh-tw
6381 !! input
6382 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6383 !! result
6384 <p>Should be stripped!
6385 </p>
6386 !! end
6387
6388
6389 !! test
6390 Raw output of variant escape tags (R flag)
6391 !! options
6392 language=zh variant=zh-tw
6393 !! input
6394 Raw: -{R|zh:China;zh-tw:Taiwan}-
6395 !! result
6396 <p>Raw: zh:China;zh-tw:Taiwan
6397 </p>
6398 !! end
6399
6400
6401 !! test
6402 Do not convert roman numbers to language variants
6403 !! options
6404 language=sr variant=sr-ec
6405 !! input
6406 Fridrih IV je car.
6407 !! result
6408 <p>Фридрих IV је цар.
6409 </p>
6410 !! end
6411
6412
6413 #
6414 #
6415 #
6416
6417 TODO:
6418 more images
6419 more tables
6420 math
6421 character entities
6422 and much more
6423 Try for 100% code coverage