Makes wikilinks nicer when possible
[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="/wiki/Help:FAQ?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="/wiki/Wikilink?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="/wiki/Museo_Picasso_(Par%C3%ADs)?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>/wiki/Some_page?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>/wiki/Some_page?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="/wiki/Zigzagzogzagzig?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="/wiki/Zigzagzogzagzig?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="/wiki/Talk:Parser_testing?action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/wiki/Meta:Disclaimers?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="/wiki/Meta:Disclaimers?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="/wiki/7%25_Solution?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="/wiki/7%25_Solution?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="/wiki/Lista_d%27%27e_paise_d%27%27o_munno?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="/wiki/Link?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="/wiki/Link?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="/wiki/Special:Upload?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="/wiki/%27%27Pentecoste%27%27?action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
1653 </p><p><a href="/wiki/%27%27Pentecoste%27%27?action=edit&amp;redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
1654 </p><p><a href="/wiki/%27%27Pentecoste%27%27?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="/wiki/Http://www.example.com?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="/wiki/RFC_123?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="/wiki/Template:Thistemplatedoesnotexist?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="/wiki/Special:Upload?wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/wiki/No_link?action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/wiki/No_link?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="/wiki/Template:Includeonly_section?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="/wiki/Template:Includeonly_section?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="/wiki/Parser_test?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="/wiki/File:Test?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="/wiki/File:Test?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="/wiki/Special:Upload?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="/wiki//subpage?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="/wiki/Page/Subpage?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Template:Sections?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="/wiki/Template:Sections?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/Special:Upload?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="/wiki/Special:Upload?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="/wiki/File:No_such.jpg?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="/wiki/Parser_test?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="/wiki/Parser_test?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="/wiki/MediaWiki:Mainpagexxx?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="/wiki/Template:Dynamic?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 HTML Hex character encoding (spells the word "JavaScript")
6839 !! input
6840 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6841 !! result
6842 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6843 </p>
6844 !! end
6845
6846 !! test
6847 HTML Hex character encoding bogus encoding (bug 26437 regression check)
6848 !! input
6849 &#xsee;&#XSEE;
6850 !! result
6851 <p>&amp;#xsee;&amp;#XSEE;
6852 </p>
6853 !! end
6854
6855 !! test
6856 HTML Hex character encoding mixed case
6857 !! input
6858 &#xEE;&#Xee;
6859 !! result
6860 <p>&#xee;&#xee;
6861 </p>
6862 !! end
6863
6864 !! test
6865 __FORCETOC__ override
6866 !! input
6867 __NEWSECTIONLINK__
6868 __FORCETOC__
6869 !! result
6870 <p><br />
6871 </p>
6872 !! end
6873
6874 !! test
6875 ISBN code coverage
6876 !! input
6877 ISBN 978-0-1234-56&#x20;789
6878 !! result
6879 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
6880 </p>
6881 !! end
6882
6883 !! test
6884 ISBN followed by 5 spaces
6885 !! input
6886 ISBN
6887 !! result
6888 <p>ISBN
6889 </p>
6890 !! end
6891
6892 !! test
6893 Double ISBN
6894 !! input
6895 ISBN ISBN 1234567890
6896 !! result
6897 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6898 </p>
6899 !! end
6900
6901 !! test
6902 Bug 22905: <abbr> followed by ISBN followed by </a>
6903 !! input
6904 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
6905 !! result
6906 <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>
6907 </p>
6908 !! end
6909
6910 !! test
6911 Double RFC
6912 !! input
6913 RFC RFC 1234
6914 !! result
6915 <p>RFC <a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
6916 </p>
6917 !! end
6918
6919 !! test
6920 Double RFC with a wiki link
6921 !! input
6922 RFC [[RFC 1234]]
6923 !! result
6924 <p>RFC <a href="/wiki/RFC_1234?action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
6925 </p>
6926 !! end
6927
6928 !! test
6929 RFC code coverage
6930 !! input
6931 RFC 983&#x20;987
6932 !! result
6933 <p><a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
6934 </p>
6935 !! end
6936
6937 !! test
6938 Centre-aligned image
6939 !! input
6940 [[Image:foobar.jpg|centre]]
6941 !! result
6942 <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>
6943
6944 !!end
6945
6946 !! test
6947 None-aligned image
6948 !! input
6949 [[Image:foobar.jpg|none]]
6950 !! result
6951 <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>
6952
6953 !!end
6954
6955 !! test
6956 Width + Height sized image (using px) (height is ignored)
6957 !! input
6958 [[Image:foobar.jpg|640x480px]]
6959 !! result
6960 <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>
6961 </p>
6962 !!end
6963
6964 !! test
6965 Width-sized image (using px, no following whitespace)
6966 !! input
6967 [[Image:foobar.jpg|640px]]
6968 !! result
6969 <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>
6970 </p>
6971 !!end
6972
6973 !! test
6974 Width-sized image (using px, with following whitespace - test regression from r39467)
6975 !! input
6976 [[Image:foobar.jpg|640px ]]
6977 !! result
6978 <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>
6979 </p>
6980 !!end
6981
6982 !! test
6983 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6984 !! input
6985 [[Image:foobar.jpg| 640px]]
6986 !! result
6987 <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>
6988 </p>
6989 !!end
6990
6991 !! test
6992 Another italics / bold test
6993 !! input
6994 ''' ''x'
6995 !! result
6996 <pre>'<i> </i>x'
6997 </pre>
6998 !!end
6999
7000 # Note the results may be incorrect, as parserTest output included this:
7001 # XML error: Mismatched tag at byte 6120:
7002 # ...<dd> </dt></dl> </dd...
7003 !! test
7004 dt/dd/dl test
7005 !! options
7006 disabled
7007 !! input
7008 :;;;::
7009 !! result
7010 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
7011 </dd></dl>
7012 </dd></dl>
7013 </dt></dl>
7014 </dt></dl>
7015 </dt></dl>
7016 </dd></dl>
7017
7018 !!end
7019
7020
7021 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
7022 !! test
7023 Images with the "|" character in the comment
7024 !! input
7025 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
7026 !! result
7027 <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>
7028
7029 !!end
7030
7031 !! test
7032 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
7033 !! input
7034 <html><script>alert(1);</script></html>
7035 !! result
7036 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
7037 </p>
7038 !! end
7039
7040 !! test
7041 HTML with raw HTML ($wgRawHtml==true)
7042 !! options
7043 rawhtml
7044 !! input
7045 <html><script>alert(1);</script></html>
7046 !! result
7047 <p><script>alert(1);</script>
7048 </p>
7049 !! end
7050
7051 !! test
7052 Parents of subpages, one level up
7053 !! options
7054 subpage title=[[Subpage test/L1/L2/L3]]
7055 !! input
7056 [[../|L2]]
7057 !! result
7058 <p><a href="/wiki/Subpage_test/L1/L2?action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
7059 </p>
7060 !! end
7061
7062
7063 !! test
7064 Parents of subpages, one level up, not named
7065 !! options
7066 subpage title=[[Subpage test/L1/L2/L3]]
7067 !! input
7068 [[../]]
7069 !! result
7070 <p><a href="/wiki/Subpage_test/L1/L2?action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
7071 </p>
7072 !! end
7073
7074
7075
7076 !! test
7077 Parents of subpages, two levels up
7078 !! options
7079 subpage title=[[Subpage test/L1/L2/L3]]
7080 !! input
7081 [[../../|L1]]2
7082
7083 [[../../|L1]]l
7084 !! result
7085 <p><a href="/wiki/Subpage_test/L1?action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
7086 </p><p><a href="/wiki/Subpage_test/L1?action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
7087 </p>
7088 !! end
7089
7090 !! test
7091 Parents of subpages, two levels up, without trailing slash or name.
7092 !! options
7093 subpage title=[[Subpage test/L1/L2/L3]]
7094 !! input
7095 [[../..]]
7096 !! result
7097 <p>[[../..]]
7098 </p>
7099 !! end
7100
7101 !! test
7102 Parents of subpages, two levels up, with lots of extra trailing slashes.
7103 !! options
7104 subpage title=[[Subpage test/L1/L2/L3]]
7105 !! input
7106 [[../../////]]
7107 !! result
7108 <p><a href="/wiki/Subpage_test/L1////?action=edit&amp;redlink=1" class="new" title="Subpage test/L1//// (page does not exist)">///</a>
7109 </p>
7110 !! end
7111
7112 !! test
7113 Definition list code coverage
7114 !! input
7115 ; title : def
7116 ; title : def
7117 ;title: def
7118 !! result
7119 <dl><dt> title &#160;</dt><dd> def
7120 </dd><dt> title&#160;</dt><dd> def
7121 </dd><dt>title</dt><dd> def
7122 </dd></dl>
7123
7124 !! end
7125
7126 !! test
7127 Don't fall for the self-closing div
7128 !! input
7129 <div>hello world</div/>
7130 !! result
7131 <div>hello world</div>
7132
7133 !! end
7134
7135 !! test
7136 MSGNW magic word
7137 !! input
7138 {{MSGNW:msg}}
7139 !! result
7140 <p>&#91;&#91;:Template:Msg&#93;&#93;
7141 </p>
7142 !! end
7143
7144 !! test
7145 RAW magic word
7146 !! input
7147 {{RAW:QUERTY}}
7148 !! result
7149 <p><a href="/wiki/Template:QUERTY?action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
7150 </p>
7151 !! end
7152
7153 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
7154 !! test
7155 Always escape literal '>' in output, not just after '<'
7156 !! input
7157 ><>
7158 !! result
7159 <p>&gt;&lt;&gt;
7160 </p>
7161 !! end
7162
7163 !! test
7164 Template caching
7165 !! input
7166 {{Test}}
7167 {{Test}}
7168 !! result
7169 <p>This is a test template
7170 This is a test template
7171 </p>
7172 !! end
7173
7174
7175 !! article
7176 MediaWiki:Fake
7177 !! text
7178 ==header==
7179 !! endarticle
7180
7181 !! test
7182 Inclusion of !userCanEdit() content
7183 !! input
7184 {{MediaWiki:Fake}}
7185 !! result
7186 <h2><span class="editsection">[<a href="/wiki/MediaWiki:Fake?action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a>]</span> <span class="mw-headline" id="header">header</span></h2>
7187
7188 !! end
7189
7190
7191 !! test
7192 Out-of-order TOC heading levels
7193 !! input
7194 ==2==
7195 ======6======
7196 ===3===
7197 =1=
7198 =====5=====
7199 ==2==
7200 !! result
7201 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7202 <ul>
7203 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
7204 <ul>
7205 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
7206 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
7207 </ul>
7208 </li>
7209 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
7210 <ul>
7211 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
7212 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
7213 </ul>
7214 </li>
7215 </ul>
7216 </td></tr></table>
7217 <h2><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=1" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2">2</span></h2>
7218 <h6><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=2" title="Edit section: 6">edit</a>]</span> <span class="mw-headline" id="6">6</span></h6>
7219 <h3><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=3" title="Edit section: 3">edit</a>]</span> <span class="mw-headline" id="3">3</span></h3>
7220 <h1><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=4" title="Edit section: 1">edit</a>]</span> <span class="mw-headline" id="1">1</span></h1>
7221 <h5><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=5" title="Edit section: 5">edit</a>]</span> <span class="mw-headline" id="5">5</span></h5>
7222 <h2><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=6" title="Edit section: 2">edit</a>]</span> <span class="mw-headline" id="2_2">2</span></h2>
7223
7224 !! end
7225
7226
7227 !! test
7228 ISBN with a dummy number
7229 !! input
7230 ISBN ---
7231 !! result
7232 <p>ISBN ---
7233 </p>
7234 !! end
7235
7236
7237 !! test
7238 ISBN with space-delimited number
7239 !! input
7240 ISBN 92 9017 032 8
7241 !! result
7242 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
7243 </p>
7244 !! end
7245
7246
7247 !! test
7248 ISBN with multiple spaces, no number
7249 !! input
7250 ISBN foo
7251 !! result
7252 <p>ISBN foo
7253 </p>
7254 !! end
7255
7256
7257 !! test
7258 ISBN length
7259 !! input
7260 ISBN 123456789
7261
7262 ISBN 1234567890
7263
7264 ISBN 12345678901
7265 !! result
7266 <p>ISBN 123456789
7267 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7268 </p><p>ISBN 12345678901
7269 </p>
7270 !! end
7271
7272
7273 !! test
7274 ISBN with trailing year (bug 8110)
7275 !! input
7276 ISBN 1-234-56789-0 - 2006
7277
7278 ISBN 1 234 56789 0 - 2006
7279 !! result
7280 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
7281 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
7282 </p>
7283 !! end
7284
7285
7286 !! test
7287 anchorencode
7288 !! input
7289 {{anchorencode:foo bar©#%n}}
7290 !! result
7291 <p>foo_bar.C2.A9.23.25n
7292 </p>
7293 !! end
7294
7295 !! test
7296 anchorencode trims spaces
7297 !! input
7298 {{anchorencode: __pretty__please__}}
7299 !! result
7300 <p>pretty_please
7301 </p>
7302 !! end
7303
7304 !! test
7305 anchorencode deals with links
7306 !! input
7307 {{anchorencode: [[hello|world]] [[hi]]}}
7308 !! result
7309 <p>world_hi
7310 </p>
7311 !! end
7312
7313 !! test
7314 anchorencode deals with templates
7315 !! input
7316 {{anchorencode: {{Foo}} }}
7317 !! result
7318 <p>FOO
7319 </p>
7320 !! end
7321
7322 !! test
7323 anchorencode encodes like the TOC generator: (bug 18431)
7324 !! input
7325 === _ +:.3A%3A&&amp;]] ===
7326 {{anchorencode: _ +:.3A%3A&&amp;]] }}
7327 __NOEDITSECTION__
7328 !! result
7329 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
7330 <p>.2B:.3A.253A.26.26.5D.5D
7331 </p>
7332 !! end
7333
7334 # Expected output in the following test is not necessarily expected (there
7335 # should probably be <p> tags inside the <blockquote> in the output) -- it's
7336 # only testing for well-formedness.
7337 !! test
7338 Bug 6200: blockquotes and paragraph formatting
7339 !! input
7340 <blockquote>
7341 foo
7342 </blockquote>
7343
7344 bar
7345
7346 baz
7347 !! result
7348 <blockquote>
7349 foo
7350 </blockquote>
7351 <p>bar
7352 </p>
7353 <pre>baz
7354 </pre>
7355 !! end
7356
7357 !! test
7358 Bug 8293: Use of center tag ruins paragraph formatting
7359 !! input
7360 <center>
7361 foo
7362 </center>
7363
7364 bar
7365
7366 baz
7367 !! result
7368 <center>
7369 <p>foo
7370 </p>
7371 </center>
7372 <p>bar
7373 </p>
7374 <pre>baz
7375 </pre>
7376 !! end
7377
7378
7379 ###
7380 ### Language variants related tests
7381 ###
7382 !! test
7383 Self-link in language variants
7384 !! options
7385 title=[[Dunav]] language=sr
7386 !! input
7387 Both [[Dunav]] and [[Дунав]] are names for this river.
7388 !! result
7389 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
7390 </p>
7391 !!end
7392
7393
7394 !! test
7395 Link to pages in language variants
7396 !! options
7397 language=sr
7398 !! input
7399 Main Page can be written as [[Маин Паге]]
7400 !! result
7401 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
7402 </p>
7403 !!end
7404
7405
7406 !! test
7407 Multiple links to pages in language variants
7408 !! options
7409 language=sr
7410 !! input
7411 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
7412 !! result
7413 <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>.
7414 </p>
7415 !!end
7416
7417
7418 !! test
7419 Simple template in language variants
7420 !! options
7421 language=sr
7422 !! input
7423 {{тест}}
7424 !! result
7425 <p>This is a test template
7426 </p>
7427 !! end
7428
7429
7430 !! test
7431 Template with explicit namespace in language variants
7432 !! options
7433 language=sr
7434 !! input
7435 {{Template:тест}}
7436 !! result
7437 <p>This is a test template
7438 </p>
7439 !! end
7440
7441
7442 !! test
7443 Basic test for template parameter in language variants
7444 !! options
7445 language=sr
7446 !! input
7447 {{парамтест|param=foo}}
7448 !! result
7449 <p>This is a test template with parameter foo
7450 </p>
7451 !! end
7452
7453
7454 !! test
7455 Simple category in language variants
7456 !! options
7457 language=sr cat
7458 !! input
7459 [[Category:МедиаWики Усер'с Гуиде]]
7460 !! result
7461 <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>
7462 !! end
7463
7464
7465 !! test
7466 Stripping -{}- tags (language variants)
7467 !! options
7468 language=sr
7469 !! input
7470 Latin proverb: -{Ne nuntium necare}-
7471 !! result
7472 <p>Latin proverb: Ne nuntium necare
7473 </p>
7474 !! end
7475
7476
7477 !! test
7478 Prevent conversion with -{}- tags (language variants)
7479 !! options
7480 language=sr variant=sr-ec
7481 !! input
7482 Latinski: -{Ne nuntium necare}-
7483 !! result
7484 <p>Латински: Ne nuntium necare
7485 </p>
7486 !! end
7487
7488
7489 !! test
7490 Prevent conversion of text with -{}- tags (language variants)
7491 !! options
7492 language=sr variant=sr-ec
7493 !! input
7494 Latinski: -{Ne nuntium necare}-
7495 !! result
7496 <p>Латински: Ne nuntium necare
7497 </p>
7498 !! end
7499
7500
7501 !! test
7502 Prevent conversion of links with -{}- tags (language variants)
7503 !! options
7504 language=sr variant=sr-ec
7505 !! input
7506 -{[[Main Page]]}-
7507 !! result
7508 <p><a href="/wiki/Main_Page">Main Page</a>
7509 </p>
7510 !! end
7511
7512
7513 !! test
7514 -{}- tags within headlines (within html for parserConvert())
7515 !! options
7516 language=sr variant=sr-ec
7517 !! input
7518 == -{Naslov}- ==
7519 !! result
7520 <h2><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=1" title="Уреди део: Naslov">уреди</a>]</span> <span class="mw-headline" id="-.7BNaslov.7D-"> Naslov </span></h2>
7521
7522 !! end
7523
7524
7525 !! test
7526 Explicit definition of language variant alternatives
7527 !! options
7528 language=zh variant=zh-tw
7529 !! input
7530 -{zh:China;zh-tw:Taiwan}-, not China
7531 !! result
7532 <p>Taiwan, not China
7533 </p>
7534 !! end
7535
7536
7537 !! test
7538 Explicit session-wise language variant mapping (A flag and - flag)
7539 !! options
7540 language=zh variant=zh-tw
7541 !! input
7542 Taiwan is not China.
7543 But -{A|zh:China;zh-tw:Taiwan}- is China,
7544 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
7545 and -{China}- is China.
7546 !! result
7547 <p>Taiwan is not China.
7548 But Taiwan is Taiwan,
7549 (This should be stripped!)
7550 and China is China.
7551 </p>
7552 !! end
7553
7554 !! test
7555 Explicit session-wise language variant mapping (H flag for hide)
7556 !! options
7557 language=zh variant=zh-tw
7558 !! input
7559 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
7560 Taiwan is China.
7561 !! result
7562 <p>(This should be stripped!)
7563 Taiwan is Taiwan.
7564 </p>
7565 !! end
7566
7567 !! test
7568 Adding explicit conversion rule for title (T flag)
7569 !! options
7570 language=zh variant=zh-tw showtitle
7571 !! input
7572 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7573 !! result
7574 Taiwan
7575 <p>Should be stripped!
7576 </p>
7577 !! end
7578
7579 !! test
7580 Testing that changing the language variant here in the tests actually works
7581 !! options
7582 language=zh variant=zh showtitle
7583 !! input
7584 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7585 !! result
7586 China
7587 <p>Should be stripped!
7588 </p>
7589 !! end
7590
7591 !! test
7592 Bug 24072: more test on conversion rule for title
7593 !! options
7594 language=zh variant=zh-tw showtitle
7595 !! input
7596 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7597 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
7598 !! result
7599 Taiwan
7600 <p>This should be stripped!
7601 This won't take interferes with the title rule.
7602 </p>
7603 !! end
7604
7605 !! test
7606 Raw output of variant escape tags (R flag)
7607 !! options
7608 language=zh variant=zh-tw
7609 !! input
7610 Raw: -{R|zh:China;zh-tw:Taiwan}-
7611 !! result
7612 <p>Raw: zh:China;zh-tw:Taiwan
7613 </p>
7614 !! end
7615
7616 !! test
7617 Nested using of manual convert syntax
7618 !! options
7619 language=zh variant=zh-hk
7620 !! input
7621 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
7622 !! result
7623 <p>Nested: Hello Hong Kong!
7624 </p>
7625 !! end
7626
7627 !! test
7628 Do not convert roman numbers to language variants
7629 !! options
7630 language=sr variant=sr-ec
7631 !! input
7632 Fridrih IV je car.
7633 !! result
7634 <p>Фридрих IV је цар.
7635 </p>
7636 !! end
7637
7638 !! test
7639 Unclosed language converter markup "-{"
7640 !! options
7641 language=sr
7642 !! input
7643 -{T|hello
7644 !! result
7645 <p>-{T|hello
7646 </p>
7647 !! end
7648
7649 !! test
7650 Don't convert raw rule "-{R|=&gt;}-" to "=>"
7651 !! options
7652 language=sr
7653 !! input
7654 -{R|=&gt;}-
7655 !! result
7656 <p>=&gt;
7657 </p>
7658 !!end
7659
7660 !!article
7661 Template:Bullet
7662 !!text
7663 * Bar
7664 !!endarticle
7665
7666 !! test
7667 Bug 529: Uncovered bullet
7668 !! input
7669 * Foo {{bullet}}
7670 !! result
7671 <ul><li> Foo
7672 </li><li> Bar
7673 </li></ul>
7674
7675 !! end
7676
7677 !! test
7678 Bug 529: Uncovered table already at line-start
7679 !! input
7680 x
7681
7682 {{table}}
7683 y
7684 !! result
7685 <p>x
7686 </p>
7687 <table>
7688 <tr>
7689 <td> 1 </td>
7690 <td> 2
7691 </td></tr>
7692 <tr>
7693 <td> 3 </td>
7694 <td> 4
7695 </td></tr></table>
7696 <p>y
7697 </p>
7698 !! end
7699
7700 !! test
7701 Bug 529: Uncovered bullet in parser function result
7702 !! input
7703 * Foo {{lc:{{bullet}} }}
7704 !! result
7705 <ul><li> Foo
7706 </li><li> bar
7707 </li></ul>
7708
7709 !! end
7710
7711 !! test
7712 Bug 5678: Double-parsed template argument
7713 !! input
7714 {{lc:{{{1}}}|hello}}
7715 !! result
7716 <p>{{{1}}}
7717 </p>
7718 !! end
7719
7720 !! test
7721 Bug 5678: Double-parsed template invocation
7722 !! input
7723 {{lc:{{paramtest {{!}} param = hello }} }}
7724 !! result
7725 <p>{{paramtest | param = hello }}
7726 </p>
7727 !! end
7728
7729 !! test
7730 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
7731 !! options
7732 language=cs
7733 title=[[Main Page]]
7734 !! input
7735 {{PRVNÍVELKÉ:ěščř}}
7736 {{prvnívelké:ěščř}}
7737 {{PRVNÍMALÉ:ěščř}}
7738 {{prvnímalé:ěščř}}
7739 {{MALÁ:ěščř}}
7740 {{malá:ěščř}}
7741 {{VELKÁ:ěščř}}
7742 {{velká:ěščř}}
7743 !! result
7744 <p>Ěščř
7745 Ěščř
7746 ěščř
7747 ěščř
7748 ěščř
7749 ěščř
7750 ĚŠČŘ
7751 ĚŠČŘ
7752 </p>
7753 !! end
7754
7755 !! test
7756 Morwen/13: Unclosed link followed by heading
7757 !! input
7758 [[link
7759 ==heading==
7760 !! result
7761 <p>[[link
7762 </p>
7763 <h2><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
7764
7765 !! end
7766
7767 !! test
7768 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7769 !! input
7770 {{foo|
7771 =heading=
7772 !! result
7773 <p>{{foo|
7774 </p>
7775 <h1> <span class="mw-headline" id="heading">heading</span></h1>
7776
7777 !! end
7778
7779 !! test
7780 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7781 !! input
7782 {{foo|
7783 ==heading==
7784 !! result
7785 <p>{{foo|
7786 </p>
7787 <h2><span class="editsection">[<a href="/wiki/Parser_test?action=edit&amp;section=1" title="Edit section: heading">edit</a>]</span> <span class="mw-headline" id="heading">heading</span></h2>
7788
7789 !! end
7790
7791 !! test
7792 Tildes in comments
7793 !! options
7794 pst
7795 !! input
7796 <!-- ~~~~ -->
7797 !! result
7798 <!-- ~~~~ -->
7799 !! end
7800
7801 !! test
7802 Paragraphs inside divs (no extra line breaks)
7803 !! input
7804 <div>Line one
7805
7806 Line two</div>
7807 !! result
7808 <div>Line one
7809 Line two</div>
7810
7811 !! end
7812
7813 !! test
7814 Paragraphs inside divs (extra line break on open)
7815 !! input
7816 <div>
7817 Line one
7818
7819 Line two</div>
7820 !! result
7821 <div>
7822 <p>Line one
7823 </p>
7824 Line two</div>
7825
7826 !! end
7827
7828 !! test
7829 Paragraphs inside divs (extra line break on close)
7830 !! input
7831 <div>Line one
7832
7833 Line two
7834 </div>
7835 !! result
7836 <div>Line one
7837 <p>Line two
7838 </p>
7839 </div>
7840
7841 !! end
7842
7843 !! test
7844 Paragraphs inside divs (extra line break on open and close)
7845 !! input
7846 <div>
7847 Line one
7848
7849 Line two
7850 </div>
7851 !! result
7852 <div>
7853 <p>Line one
7854 </p><p>Line two
7855 </p>
7856 </div>
7857
7858 !! end
7859
7860 !! test
7861 Nesting tags, paragraphs on lines which begin with <div>
7862 !! options
7863 disabled
7864 !! input
7865 <div></div><strong>A
7866 B</strong>
7867 !! result
7868 <div></div>
7869 <p><strong>A
7870 B</strong>
7871 </p>
7872 !! end
7873
7874 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7875 !! test
7876 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7877 !! options
7878 disabled
7879 !! input
7880 <blockquote>Line one
7881
7882 Line two</blockquote>
7883 !! result
7884 <blockquote>Line one
7885 Line two</blockquote>
7886
7887 !! end
7888
7889 !! test
7890 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7891 !! options
7892 disabled
7893 !! input
7894 <blockquote>
7895 Line one
7896
7897 Line two</blockquote>
7898 !! result
7899 <blockquote>
7900 <p>Line one
7901 </p>
7902 Line two</blockquote>
7903
7904 !! end
7905
7906 !! test
7907 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7908 !! options
7909 disabled
7910 !! input
7911 <blockquote>Line one
7912
7913 Line two
7914 </blockquote>
7915 !! result
7916 <blockquote>Line one
7917 <p>Line two
7918 </p>
7919 </blockquote>
7920
7921 !! end
7922
7923 !! test
7924 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7925 !! options
7926 disabled
7927 !! input
7928 <blockquote>
7929 Line one
7930
7931 Line two
7932 </blockquote>
7933 !! result
7934 <blockquote>
7935 <p>Line one
7936 </p><p>Line two
7937 </p>
7938 </blockquote>
7939
7940 !! end
7941
7942 !! test
7943 Paragraphs inside blockquotes/divs (no extra line breaks)
7944 !! input
7945 <blockquote><div>Line one
7946
7947 Line two</div></blockquote>
7948 !! result
7949 <blockquote><div>Line one
7950 Line two</div></blockquote>
7951
7952 !! end
7953
7954 !! test
7955 Paragraphs inside blockquotes/divs (extra line break on open)
7956 !! input
7957 <blockquote><div>
7958 Line one
7959
7960 Line two</div></blockquote>
7961 !! result
7962 <blockquote><div>
7963 <p>Line one
7964 </p>
7965 Line two</div></blockquote>
7966
7967 !! end
7968
7969 !! test
7970 Paragraphs inside blockquotes/divs (extra line break on close)
7971 !! input
7972 <blockquote><div>Line one
7973
7974 Line two
7975 </div></blockquote>
7976 !! result
7977 <blockquote><div>Line one
7978 <p>Line two
7979 </p>
7980 </div></blockquote>
7981
7982 !! end
7983
7984 !! test
7985 Paragraphs inside blockquotes/divs (extra line break on open and close)
7986 !! input
7987 <blockquote><div>
7988 Line one
7989
7990 Line two
7991 </div></blockquote>
7992 !! result
7993 <blockquote><div>
7994 <p>Line one
7995 </p><p>Line two
7996 </p>
7997 </div></blockquote>
7998
7999 !! end
8000
8001 !! test
8002 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
8003 !! options
8004 wgLinkHolderBatchSize=0
8005 !! input
8006 [[meatball:1]]
8007 [[meatball:2]]
8008 [[meatball:3]]
8009 !! result
8010 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw">meatball:1</a>
8011 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw">meatball:2</a>
8012 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw">meatball:3</a>
8013 </p>
8014 !! end
8015
8016 !! test
8017 Free external link invading image caption
8018 !! input
8019 [[Image:Foobar.jpg|thumb|http://x|hello]]
8020 !! result
8021 <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>
8022
8023 !! end
8024
8025 !! test
8026 Bug 15196: localised external link numbers
8027 !! options
8028 language=fa
8029 !! input
8030 [http://en.wikipedia.org/]
8031 !! result
8032 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
8033 </p>
8034 !! end
8035
8036 !! test
8037 Multibyte character in padleft
8038 !! input
8039 {{padleft:-Hello|7|Æ}}
8040 !! result
8041 <p>Æ-Hello
8042 </p>
8043 !! end
8044
8045 !! test
8046 Multibyte character in padright
8047 !! input
8048 {{padright:Hello-|7|Æ}}
8049 !! result
8050 <p>Hello-Æ
8051 </p>
8052 !! end
8053
8054 !! test
8055 Formatted date
8056 !! config
8057 wgUseDynamicDates=1
8058 !! input
8059 [[2009-03-24]]
8060 !! result
8061 <p><span class="mw-formatted-date" title="2009-03-24"><a href="/wiki/2009?action=edit&amp;redlink=1" class="new" title="2009 (page does not exist)">2009</a>-<a href="/wiki/March_24?action=edit&amp;redlink=1" class="new" title="March 24 (page does not exist)">03-24</a></span>
8062 </p>
8063 !!end
8064
8065 !!test
8066 formatdate parser function
8067 !!input
8068 {{#formatdate:2009-03-24}}
8069 !! result
8070 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
8071 </p>
8072 !! end
8073
8074 !!test
8075 formatdate parser function, with default format
8076 !!input
8077 {{#formatdate:2009-03-24|mdy}}
8078 !! result
8079 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
8080 </p>
8081 !! end
8082
8083 !! test
8084 Linked date with autoformatting disabled
8085 !! config
8086 wgUseDynamicDates=false
8087 !! input
8088 [[2009-03-24]]
8089 !! result
8090 <p><a href="/wiki/2009-03-24?action=edit&amp;redlink=1" class="new" title="2009-03-24 (page does not exist)">2009-03-24</a>
8091 </p>
8092 !! end
8093
8094 !! test
8095 Spacing of numbers in formatted dates
8096 !! input
8097 {{#formatdate:January 15}}
8098 !! result
8099 <p><span class="mw-formatted-date" title="01-15">January 15</span>
8100 </p>
8101 !! end
8102
8103 !! test
8104 Spacing of numbers in formatted dates (linked)
8105 !! config
8106 wgUseDynamicDates=true
8107 !! input
8108 [[January 15]]
8109 !! result
8110 <p><span class="mw-formatted-date" title="01-15"><a href="/wiki/January_15?action=edit&amp;redlink=1" class="new" title="January 15 (page does not exist)">January 15</a></span>
8111 </p>
8112 !! end
8113
8114 #
8115 #
8116 #
8117
8118 #
8119 # Edit comments
8120 #
8121
8122 !! test
8123 Edit comment with link
8124 !! options
8125 comment
8126 !! input
8127 I like the [[Main Page]] a lot
8128 !! result
8129 I like the <a href="/wiki/Main_Page">Main Page</a> a lot
8130 !!end
8131
8132 !! test
8133 Edit comment with link and link text
8134 !! options
8135 comment
8136 !! input
8137 I like the [[Main Page|best pages]] a lot
8138 !! result
8139 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8140 !!end
8141
8142 !! test
8143 Edit comment with link and link text with suffix
8144 !! options
8145 comment
8146 !! input
8147 I like the [[Main Page|best page]]s a lot
8148 !! result
8149 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8150 !!end
8151
8152 !! test
8153 Edit comment with section link (non-local, eg in history list)
8154 !! options
8155 comment title=[[Main Page]]
8156 !! input
8157 /* External links */ removed bogus entries
8158 !! result
8159 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
8160 !!end
8161
8162 !! test
8163 Edit comment with section link (local, eg in diff view)
8164 !! options
8165 comment local title=[[Main Page]]
8166 !! input
8167 /* External links */ removed bogus entries
8168 !! result
8169 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
8170 !!end
8171
8172 !! test
8173 Edit comment with subpage link (bug 14080)
8174 !! options
8175 comment
8176 subpage
8177 title=[[Subpage test]]
8178 !! input
8179 Poked at a [[/subpage]] here...
8180 !! result
8181 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
8182 !!end
8183
8184 !! test
8185 Edit comment with subpage link and link text (bug 14080)
8186 !! options
8187 comment
8188 subpage
8189 title=[[Subpage test]]
8190 !! input
8191 Poked at a [[/subpage|neat little page]] here...
8192 !! result
8193 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
8194 !!end
8195
8196 !! test
8197 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
8198 !! options
8199 comment
8200 title=[[Subpage test]]
8201 !! input
8202 Poked at a [[/subpage]] here...
8203 !! result
8204 Poked at a <a href="/wiki//subpage?action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
8205 !!end
8206
8207 !! test
8208 Edit comment with bare anchor link (local, as on diff)
8209 !! options
8210 comment
8211 local
8212 title=[[Main Page]]
8213 !!input
8214 [[#section]]
8215 !! result
8216 <a href="#section">#section</a>
8217 !! end
8218
8219 !! test
8220 Edit comment with bare anchor link (non-local, as on history)
8221 !! options
8222 comment
8223 title=[[Main Page]]
8224 !!input
8225 [[#section]]
8226 !! result
8227 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
8228 !! end
8229
8230 !! test
8231 Space normalisation on autocomment (bug 22784)
8232 !! options
8233 comment
8234 title=[[Main Page]]
8235 !!input
8236 /* __hello__world__ */
8237 !! result
8238 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
8239 !! end
8240
8241 !! test
8242 percent-encoding and + signs in comments (Bug 26410)
8243 !! options
8244 comment
8245 !!input
8246 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
8247 !! result
8248 <a href="/wiki/ABC3D%25_%2B%2B?action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/wiki/ABC3D%25_%2B%2B?action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
8249 !! end
8250
8251 !! test
8252 Bad images - basic functionality
8253 !! input
8254 [[File:Bad.jpg]]
8255 !! result
8256 !! end
8257
8258 !! test
8259 Bad images - bug 16039: text after bad image disappears
8260 !! input
8261 Foo bar
8262 [[File:Bad.jpg]]
8263 Bar foo
8264 !! result
8265 <p>Foo bar
8266 </p><p>Bar foo
8267 </p>
8268 !! end
8269
8270 !! test
8271 Verify that displaytitle works (bug #22501) no displaytitle
8272 !! options
8273 showtitle
8274 !! config
8275 wgAllowDisplayTitle=true
8276 wgRestrictDisplayTitle=false
8277 !! input
8278 this is not the the title
8279 !! result
8280 Parser test
8281 <p>this is not the the title
8282 </p>
8283 !! end
8284
8285 !! test
8286 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
8287 !! options
8288 showtitle
8289 title=[[Screen]]
8290 !! config
8291 wgAllowDisplayTitle=true
8292 wgRestrictDisplayTitle=false
8293 !! input
8294 this is not the the title
8295 {{DISPLAYTITLE:whatever}}
8296 !! result
8297 whatever
8298 <p>this is not the the title
8299 </p>
8300 !! end
8301
8302 !! test
8303 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
8304 !! options
8305 showtitle
8306 title=[[Screen]]
8307 !! config
8308 wgAllowDisplayTitle=true
8309 wgRestrictDisplayTitle=true
8310 !! input
8311 this is not the the title
8312 {{DISPLAYTITLE:whatever}}
8313 !! result
8314 Screen
8315 <p>this is not the the title
8316 </p>
8317 !! end
8318
8319 !! test
8320 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
8321 !! options
8322 showtitle
8323 title=[[Screen]]
8324 !! config
8325 wgAllowDisplayTitle=true
8326 wgRestrictDisplayTitle=true
8327 !! input
8328 this is not the the title
8329 {{DISPLAYTITLE:screen}}
8330 !! result
8331 screen
8332 <p>this is not the the title
8333 </p>
8334 !! end
8335
8336 !! test
8337 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
8338 !! options
8339 showtitle
8340 title=[[Screen]]
8341 !! config
8342 wgAllowDisplayTitle=false
8343 !! input
8344 this is not the the title
8345 {{DISPLAYTITLE:screen}}
8346 !! result
8347 Screen
8348 <p>this is not the the title
8349 <a href="/wiki/Template:DISPLAYTITLE:screen?action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
8350 </p>
8351 !! end
8352
8353 !! test
8354 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
8355 !! options
8356 showtitle
8357 title=[[Screen]]
8358 !! config
8359 wgAllowDisplayTitle=false
8360 !! input
8361 this is not the the title
8362 !! result
8363 Screen
8364 <p>this is not the the title
8365 </p>
8366 !! end
8367
8368 !! test
8369 preload: check <noinclude> and <includeonly>
8370 !! options
8371 preload
8372 !! input
8373 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
8374 !! result
8375 Hello kind world.
8376 !! end
8377
8378 !! test
8379 preload: check <onlyinclude>
8380 !! options
8381 preload
8382 !! input
8383 Goodbye <onlyinclude>Hello world</onlyinclude>
8384 !! result
8385 Hello world
8386 !! end
8387
8388 !! test
8389 preload: can pass tags through if we want to
8390 !! options
8391 preload
8392 !! input
8393 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
8394 !! result
8395 <includeonly>Hello world</includeonly>
8396 !! end
8397
8398 !! test
8399 preload: check that it doesn't try to do tricks
8400 !! options
8401 preload
8402 !! input
8403 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8404 !! result
8405 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8406 !! end
8407
8408 !! test
8409 Play a bit with r67090 and bug 3158
8410 !! options
8411 disabled
8412 !! input
8413 <div style="width:50% !important">&nbsp;</div>
8414 <div style="width:50%&nbsp;!important">&nbsp;</div>
8415 <div style="width:50%&#160;!important">&nbsp;</div>
8416 <div style="border : solid;">&nbsp;</div>
8417 !! result
8418 <div style="width:50% !important">&nbsp;</div>
8419 <div style="width:50% !important">&nbsp;</div>
8420 <div style="width:50% !important">&nbsp;</div>
8421 <div style="border&#160;: solid;">&nbsp;</div>
8422
8423 !! end
8424
8425 !! test
8426 HTML5 data attributes
8427 !! input
8428 <span data-foo="bar">Baz</span>
8429 <p data-abc-def_hij="">Quuz</p>
8430 !! result
8431 <p><span data-foo="bar">Baz</span>
8432 </p>
8433 <p data-abc-def_hij="">Quuz</p>
8434
8435 !! end
8436
8437 !! test
8438 percent-encoding and + signs in internal links (Bug 26410)
8439 !! input
8440 [[User:+%]] [[Page+title%]]
8441 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
8442 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
8443 [[%33%45]] [[%33%45+]]
8444 !! result
8445 <p><a href="/wiki/User:%2B%25?action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/wiki/Page%2Btitle%25?action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
8446 <a href="/wiki/%25%2B?action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/wiki/%25%2B?action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/wiki/%25%2B?action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/wiki/%25%2Br?action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
8447 <a href="/wiki/%25?action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/wiki/%2B?action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/wiki/Special:Upload?wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
8448 <a href="/wiki/3E?action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/wiki/3E%2B?action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
8449 </p>
8450 !! end
8451
8452 !! test
8453 Special characters in embedded file links (bug 27679)
8454 !! input
8455 [[File:Contains & ampersand.jpg]]
8456 [[File:Does not exist.jpg|Title with & ampersand]]
8457 !! result
8458 <p><a href="/wiki/Special:Upload?wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
8459 <a href="/wiki/Special:Upload?wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
8460 </p>
8461 !! end
8462
8463 !! article
8464 A
8465 !! text
8466 A
8467 !! endarticle
8468
8469 !! article
8470 Ä
8471 !! text
8472 Ä
8473 !! endarticle
8474
8475 !! test
8476 Bug#542 Link text shouldn't be duplicated in title attributes
8477 !! input
8478 [[A]] [[a]] [[Ä]] [[ä]]
8479 !! result
8480 <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>
8481 </p>
8482 !! end
8483
8484 TODO:
8485 more images
8486 more tables
8487 math
8488 character entities
8489 and much more
8490 Try for 100% code coverage