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