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