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