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