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