(no commit message)
[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 !! result
5485 <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>
5486 <table style="&#95;_TOC&#95;_">
5487 <tr><td></td></tr>
5488 </table>
5489
5490 !! end
5491
5492 # Known to produce bogus xml (extra </td>)
5493 !! test
5494 Fuzz testing: Parser16
5495 !! options
5496 noxml
5497 !! input
5498 {|
5499 !https://||||||
5500 !! result
5501 <table>
5502 <tr>
5503 <th>https://</th>
5504 <th></th>
5505 <th></th>
5506 <th></th>
5507 </tr>
5508 </table>
5509
5510 !! end
5511
5512 !! test
5513 Fuzz testing: Parser21
5514 !! input
5515 {|
5516 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5517 |
5518 !! result
5519 <table>
5520 <tr>
5521 <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"</th>
5522 <td></td>
5523 </tr>
5524 </table>
5525
5526 !! end
5527
5528 !! test
5529 Fuzz testing: Parser22
5530 !! input
5531 http://===r:::https://b
5532
5533 {|
5534 !!result
5535 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
5536 </p>
5537 <table>
5538 <tr><td></td></tr>
5539 </table>
5540
5541 !! end
5542
5543 # Known to produce bad XML for now
5544
5545 # Note: the current result listed for this is not what the original one was,
5546 # but the original bug was JavaScript injection, which is fixed in any case.
5547 # It's not clear that the original result listed was any more correct than the
5548 # current one. Original result:
5549 # <table>
5550 # {{{|
5551 # <u class="&#124;">}}}} &gt;
5552 # <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5553 #
5554 # MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5555 # <tr>
5556 # <td></u>
5557 # </td>
5558 # </tr>
5559 # </table>
5560 !! test
5561 Fuzz testing: Parser24
5562 !! options
5563 noxml
5564 !! input
5565 {|
5566 {{{|
5567 <u CLASS=
5568 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5569 <br style="onmouseover='alert(document.cookie);' " />
5570
5571 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5572 |
5573 !! result
5574 <p>{{{|
5575 <u class="&#124;">}}}} &gt;
5576 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5577 </p><p>MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5578 </p>
5579 <table>
5580 <tr>
5581 <td></u></td>
5582 </tr>
5583 </table>
5584
5585 !! end
5586
5587 # Note: the current result listed for this is not what the original one was,
5588 # but the original bug was JavaScript injection, which is fixed in any case.
5589 # It's not clear that the original result listed was any more correct than the
5590 # current one. Original result:
5591 # <p>{{{|
5592 # </p>
5593 # <li class="&#124;&#124;">
5594 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5595 !!test
5596 Fuzz testing: Parser25 (bug 6055)
5597 !! input
5598 {{{
5599 |
5600 <LI CLASS=||
5601 >
5602 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5603 !! result
5604 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5605 </p>
5606 !! end
5607
5608 !!test
5609 Fuzz testing: URL adjacent extension (with space, clean)
5610 !! options
5611 !! input
5612 http://example.com <nowiki>junk</nowiki>
5613 !! result
5614 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
5615 </p>
5616 !!end
5617
5618 !!test
5619 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5620 !! options
5621 !! input
5622 http://example.com<nowiki>junk</nowiki>
5623 !! result
5624 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
5625 </p>
5626 !!end
5627
5628 !!test
5629 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5630 !! options
5631 !! input
5632 http://example.com<pre>junk</pre>
5633 !! result
5634 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
5635
5636 !!end
5637
5638 !!test
5639 Fuzz testing: image with bogus manual thumbnail
5640 !!input
5641 [[Image:foobar.jpg|thumbnail= ]]
5642 !!result
5643 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
5644
5645 !!end
5646
5647 !! test
5648 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5649 !! input
5650 <pre dir="&#10;"></pre>
5651 !! result
5652 <pre dir="&#10;"></pre>
5653
5654 !! end
5655
5656 !! test
5657 Parsing optional HTML elements (Bug 6171)
5658 !! options
5659 !! input
5660 <table>
5661 <tr>
5662 <td> Some tabular data</td>
5663 <td> More tabular data ...
5664 <td> And yet som tabular data</td>
5665 </tr>
5666 </table>
5667 !! result
5668 <table>
5669 <tr>
5670 <td> Some tabular data</td>
5671 <td> More tabular data ...
5672 </td><td> And yet som tabular data</td>
5673 </tr>
5674 </table>
5675
5676 !! end
5677
5678 !! test
5679 Correct handling of <td>, <tr> (Bug 6171)
5680 !! options
5681 !! input
5682 <table>
5683 <tr>
5684 <td> Some tabular data</td>
5685 <td> More tabular data ...</td>
5686 <td> And yet som tabular data</td>
5687 </tr>
5688 </table>
5689 !! result
5690 <table>
5691 <tr>
5692 <td> Some tabular data</td>
5693 <td> More tabular data ...</td>
5694 <td> And yet som tabular data</td>
5695 </tr>
5696 </table>
5697
5698 !! end
5699
5700
5701 !! test
5702 Parsing crashing regression (fr:JavaScript)
5703 !! input
5704 </body></x>
5705 !! result
5706 <p>&lt;/body&gt;&lt;/x&gt;
5707 </p>
5708 !! end
5709
5710 !! test
5711 Inline wiki vs wiki block nesting
5712 !! input
5713 '''Bold paragraph
5714
5715 New wiki paragraph
5716 !! result
5717 <p><b>Bold paragraph</b>
5718 </p><p>New wiki paragraph
5719 </p>
5720 !! end
5721
5722 !! test
5723 Inline HTML vs wiki block nesting
5724 !! options
5725 disabled
5726 !! input
5727 <b>Bold paragraph
5728
5729 New wiki paragraph
5730 !! result
5731 <p><b>Bold paragraph</b>
5732 </p><p>New wiki paragraph
5733 </p>
5734 !! end
5735
5736 # Original result was this:
5737 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5738 # </p>
5739 # While that might be marginally more intuitive, maybe, the six-apostrophe
5740 # construct is clearly pathological and the result stated here (which is what
5741 # the parser actually does) is about as reasonable as anything.
5742 !!test
5743 Mixing markup for italics and bold
5744 !! options
5745 !! input
5746 '''bold''''''bold''bolditalics'''''
5747 !! result
5748 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5749 </p>
5750 !! end
5751
5752
5753 !! article
5754 Xyzzyx
5755 !! text
5756 Article for special page transclusion test
5757 !! endarticle
5758
5759 !! test
5760 Special page transclusion
5761 !! options
5762 !! input
5763 {{Special:Prefixindex/Xyzzyx}}
5764 !! result
5765 <p><br />
5766 </p>
5767 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
5768
5769 !! end
5770
5771 !! test
5772 Special page transclusion twice (bug 5021)
5773 !! options
5774 !! input
5775 {{Special:Prefixindex/Xyzzyx}}
5776 {{Special:Prefixindex/Xyzzyx}}
5777 !! result
5778 <p><br />
5779 </p>
5780 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
5781 <p><br />
5782 </p>
5783 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx">Xyzzyx</a></td></tr></table>
5784
5785 !! end
5786
5787 !! test
5788 Transclusion of default MediaWiki message
5789 !! input
5790 {{MediaWiki:Mainpage}}
5791 !!result
5792 <p>Main Page
5793 </p>
5794 !! end
5795
5796 !! test
5797 Transclusion of nonexistent MediaWiki message
5798 !! input
5799 {{MediaWiki:Mainpagexxx}}
5800 !!result
5801 <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>
5802 </p>
5803 !! end
5804
5805 !! test
5806 Transclusion of MediaWiki message with underscore
5807 !! input
5808 {{MediaWiki:history_short}}
5809 !! result
5810 <p>History
5811 </p>
5812 !! end
5813
5814 !! test
5815 Transclusion of MediaWiki message with space
5816 !! input
5817 {{MediaWiki:history short}}
5818 !! result
5819 <p>History
5820 </p>
5821 !! end
5822
5823 !! test
5824 Invalid header with following text
5825 !! input
5826 = x = y
5827 !! result
5828 <p>= x = y
5829 </p>
5830 !! end
5831
5832
5833 !! test
5834 Section extraction test (section 0)
5835 !! options
5836 section=0
5837 !! input
5838 start
5839 ==a==
5840 ===aa===
5841 ====aaa====
5842 ==b==
5843 ===ba===
5844 ===bb===
5845 ====bba====
5846 ===bc===
5847 ==c==
5848 ===ca===
5849 !! result
5850 start
5851 !! end
5852
5853 !! test
5854 Section extraction test (section 1)
5855 !! options
5856 section=1
5857 !! input
5858 start
5859 ==a==
5860 ===aa===
5861 ====aaa====
5862 ==b==
5863 ===ba===
5864 ===bb===
5865 ====bba====
5866 ===bc===
5867 ==c==
5868 ===ca===
5869 !! result
5870 ==a==
5871 ===aa===
5872 ====aaa====
5873 !! end
5874
5875 !! test
5876 Section extraction test (section 2)
5877 !! options
5878 section=2
5879 !! input
5880 start
5881 ==a==
5882 ===aa===
5883 ====aaa====
5884 ==b==
5885 ===ba===
5886 ===bb===
5887 ====bba====
5888 ===bc===
5889 ==c==
5890 ===ca===
5891 !! result
5892 ===aa===
5893 ====aaa====
5894 !! end
5895
5896 !! test
5897 Section extraction test (section 3)
5898 !! options
5899 section=3
5900 !! input
5901 start
5902 ==a==
5903 ===aa===
5904 ====aaa====
5905 ==b==
5906 ===ba===
5907 ===bb===
5908 ====bba====
5909 ===bc===
5910 ==c==
5911 ===ca===
5912 !! result
5913 ====aaa====
5914 !! end
5915
5916 !! test
5917 Section extraction test (section 4)
5918 !! options
5919 section=4
5920 !! input
5921 start
5922 ==a==
5923 ===aa===
5924 ====aaa====
5925 ==b==
5926 ===ba===
5927 ===bb===
5928 ====bba====
5929 ===bc===
5930 ==c==
5931 ===ca===
5932 !! result
5933 ==b==
5934 ===ba===
5935 ===bb===
5936 ====bba====
5937 ===bc===
5938 !! end
5939
5940 !! test
5941 Section extraction test (section 5)
5942 !! options
5943 section=5
5944 !! input
5945 start
5946 ==a==
5947 ===aa===
5948 ====aaa====
5949 ==b==
5950 ===ba===
5951 ===bb===
5952 ====bba====
5953 ===bc===
5954 ==c==
5955 ===ca===
5956 !! result
5957 ===ba===
5958 !! end
5959
5960 !! test
5961 Section extraction test (section 6)
5962 !! options
5963 section=6
5964 !! input
5965 start
5966 ==a==
5967 ===aa===
5968 ====aaa====
5969 ==b==
5970 ===ba===
5971 ===bb===
5972 ====bba====
5973 ===bc===
5974 ==c==
5975 ===ca===
5976 !! result
5977 ===bb===
5978 ====bba====
5979 !! end
5980
5981 !! test
5982 Section extraction test (section 7)
5983 !! options
5984 section=7
5985 !! input
5986 start
5987 ==a==
5988 ===aa===
5989 ====aaa====
5990 ==b==
5991 ===ba===
5992 ===bb===
5993 ====bba====
5994 ===bc===
5995 ==c==
5996 ===ca===
5997 !! result
5998 ====bba====
5999 !! end
6000
6001 !! test
6002 Section extraction test (section 8)
6003 !! options
6004 section=8
6005 !! input
6006 start
6007 ==a==
6008 ===aa===
6009 ====aaa====
6010 ==b==
6011 ===ba===
6012 ===bb===
6013 ====bba====
6014 ===bc===
6015 ==c==
6016 ===ca===
6017 !! result
6018 ===bc===
6019 !! end
6020
6021 !! test
6022 Section extraction test (section 9)
6023 !! options
6024 section=9
6025 !! input
6026 start
6027 ==a==
6028 ===aa===
6029 ====aaa====
6030 ==b==
6031 ===ba===
6032 ===bb===
6033 ====bba====
6034 ===bc===
6035 ==c==
6036 ===ca===
6037 !! result
6038 ==c==
6039 ===ca===
6040 !! end
6041
6042 !! test
6043 Section extraction test (section 10)
6044 !! options
6045 section=10
6046 !! input
6047 start
6048 ==a==
6049 ===aa===
6050 ====aaa====
6051 ==b==
6052 ===ba===
6053 ===bb===
6054 ====bba====
6055 ===bc===
6056 ==c==
6057 ===ca===
6058 !! result
6059 ===ca===
6060 !! end
6061
6062 !! test
6063 Section extraction test (nonexistent section 11)
6064 !! options
6065 section=11
6066 !! input
6067 start
6068 ==a==
6069 ===aa===
6070 ====aaa====
6071 ==b==
6072 ===ba===
6073 ===bb===
6074 ====bba====
6075 ===bc===
6076 ==c==
6077 ===ca===
6078 !! result
6079 !! end
6080
6081 !! test
6082 Section extraction test with bogus heading (section 1)
6083 !! options
6084 section=1
6085 !! input
6086 ==a==
6087 ==bogus== not a legal section
6088 ==b==
6089 !! result
6090 ==a==
6091 ==bogus== not a legal section
6092 !! end
6093
6094 !! test
6095 Section extraction test with bogus heading (section 2)
6096 !! options
6097 section=2
6098 !! input
6099 ==a==
6100 ==bogus== not a legal section
6101 ==b==
6102 !! result
6103 ==b==
6104 !! end
6105
6106 !! test
6107 Section extraction test with comment after heading (section 1)
6108 !! options
6109 section=1
6110 !! input
6111 ==a==
6112 ==b== <!-- -->
6113 ==c==
6114 !! result
6115 ==a==
6116 !! end
6117
6118 !! test
6119 Section extraction test with comment after heading (section 2)
6120 !! options
6121 section=2
6122 !! input
6123 ==a==
6124 ==b== <!-- -->
6125 ==c==
6126 !! result
6127 ==b== <!-- -->
6128 !! end
6129
6130 !! test
6131 Section extraction test with bogus <nowiki> heading (section 1)
6132 !! options
6133 section=1
6134 !! input
6135 ==a==
6136 ==bogus== <nowiki>not a legal section</nowiki>
6137 ==b==
6138 !! result
6139 ==a==
6140 ==bogus== <nowiki>not a legal section</nowiki>
6141 !! end
6142
6143 !! test
6144 Section extraction test with bogus <nowiki> heading (section 2)
6145 !! options
6146 section=2
6147 !! input
6148 ==a==
6149 ==bogus== <nowiki>not a legal section</nowiki>
6150 ==b==
6151 !! result
6152 ==b==
6153 !! end
6154
6155
6156 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
6157 # instead of respecting commented sections
6158 !! test
6159 Section extraction prefixed by comment (section 1)
6160 !! options
6161 section=1
6162 !! input
6163 <!-- -->==sec1==
6164 ==sec2==
6165 !!result
6166 ==sec2==
6167 !!end
6168
6169 !! test
6170 Section extraction prefixed by comment (section 2)
6171 !! options
6172 section=2
6173 !! input
6174 <!-- -->==sec1==
6175 ==sec2==
6176 !!result
6177
6178 !!end
6179
6180
6181 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
6182 # instead of respecting HTML-style headings
6183 !! test
6184 Section extraction, mixed wiki and html (section 1)
6185 !! options
6186 section=1
6187 !! input
6188 <h2>unmarked</h2>
6189 unmarked
6190 ==1==
6191 one
6192 ==2==
6193 two
6194 !! result
6195 ==1==
6196 one
6197 !! end
6198
6199 !! test
6200 Section extraction, mixed wiki and html (section 2)
6201 !! options
6202 section=2
6203 !! input
6204 <h2>unmarked</h2>
6205 unmarked
6206 ==1==
6207 one
6208 ==2==
6209 two
6210 !! result
6211 ==2==
6212 two
6213 !! end
6214
6215
6216 # Formerly testing for bug 3342
6217 !! test
6218 Section extraction, heading surrounded by <noinclude>
6219 !! options
6220 section=1
6221 !! input
6222 <noinclude>==unmarked==</noinclude>
6223 ==marked==
6224 !! result
6225 ==marked==
6226 !!end
6227
6228 # Test behaviour of bug 19910
6229 !! test
6230 Sectiion with all-equals
6231 !! options
6232 section=2
6233 !! input
6234 ===
6235 The line above must have a trailing space
6236 === <!--
6237 --> <!-- -->
6238 But just in case it doesn't...
6239 !! result
6240 === <!--
6241 --> <!-- -->
6242 But just in case it doesn't...
6243 !! end
6244
6245 !! test
6246 Section replacement test (section 0)
6247 !! options
6248 replace=0,"xxx"
6249 !! input
6250 start
6251 ==a==
6252 ===aa===
6253 ====aaa====
6254 ==b==
6255 ===ba===
6256 ===bb===
6257 ====bba====
6258 ===bc===
6259 ==c==
6260 ===ca===
6261 !! result
6262 xxx
6263
6264 ==a==
6265 ===aa===
6266 ====aaa====
6267 ==b==
6268 ===ba===
6269 ===bb===
6270 ====bba====
6271 ===bc===
6272 ==c==
6273 ===ca===
6274 !! end
6275
6276 !! test
6277 Section replacement test (section 1)
6278 !! options
6279 replace=1,"xxx"
6280 !! input
6281 start
6282 ==a==
6283 ===aa===
6284 ====aaa====
6285 ==b==
6286 ===ba===
6287 ===bb===
6288 ====bba====
6289 ===bc===
6290 ==c==
6291 ===ca===
6292 !! result
6293 start
6294 xxx
6295
6296 ==b==
6297 ===ba===
6298 ===bb===
6299 ====bba====
6300 ===bc===
6301 ==c==
6302 ===ca===
6303 !! end
6304
6305 !! test
6306 Section replacement test (section 2)
6307 !! options
6308 replace=2,"xxx"
6309 !! input
6310 start
6311 ==a==
6312 ===aa===
6313 ====aaa====
6314 ==b==
6315 ===ba===
6316 ===bb===
6317 ====bba====
6318 ===bc===
6319 ==c==
6320 ===ca===
6321 !! result
6322 start
6323 ==a==
6324 xxx
6325
6326 ==b==
6327 ===ba===
6328 ===bb===
6329 ====bba====
6330 ===bc===
6331 ==c==
6332 ===ca===
6333 !! end
6334
6335 !! test
6336 Section replacement test (section 3)
6337 !! options
6338 replace=3,"xxx"
6339 !! input
6340 start
6341 ==a==
6342 ===aa===
6343 ====aaa====
6344 ==b==
6345 ===ba===
6346 ===bb===
6347 ====bba====
6348 ===bc===
6349 ==c==
6350 ===ca===
6351 !! result
6352 start
6353 ==a==
6354 ===aa===
6355 xxx
6356
6357 ==b==
6358 ===ba===
6359 ===bb===
6360 ====bba====
6361 ===bc===
6362 ==c==
6363 ===ca===
6364 !! end
6365
6366 !! test
6367 Section replacement test (section 4)
6368 !! options
6369 replace=4,"xxx"
6370 !! input
6371 start
6372 ==a==
6373 ===aa===
6374 ====aaa====
6375 ==b==
6376 ===ba===
6377 ===bb===
6378 ====bba====
6379 ===bc===
6380 ==c==
6381 ===ca===
6382 !! result
6383 start
6384 ==a==
6385 ===aa===
6386 ====aaa====
6387 xxx
6388
6389 ==c==
6390 ===ca===
6391 !! end
6392
6393 !! test
6394 Section replacement test (section 5)
6395 !! options
6396 replace=5,"xxx"
6397 !! input
6398 start
6399 ==a==
6400 ===aa===
6401 ====aaa====
6402 ==b==
6403 ===ba===
6404 ===bb===
6405 ====bba====
6406 ===bc===
6407 ==c==
6408 ===ca===
6409 !! result
6410 start
6411 ==a==
6412 ===aa===
6413 ====aaa====
6414 ==b==
6415 xxx
6416
6417 ===bb===
6418 ====bba====
6419 ===bc===
6420 ==c==
6421 ===ca===
6422 !! end
6423
6424 !! test
6425 Section replacement test (section 6)
6426 !! options
6427 replace=6,"xxx"
6428 !! input
6429 start
6430 ==a==
6431 ===aa===
6432 ====aaa====
6433 ==b==
6434 ===ba===
6435 ===bb===
6436 ====bba====
6437 ===bc===
6438 ==c==
6439 ===ca===
6440 !! result
6441 start
6442 ==a==
6443 ===aa===
6444 ====aaa====
6445 ==b==
6446 ===ba===
6447 xxx
6448
6449 ===bc===
6450 ==c==
6451 ===ca===
6452 !! end
6453
6454 !! test
6455 Section replacement test (section 7)
6456 !! options
6457 replace=7,"xxx"
6458 !! input
6459 start
6460 ==a==
6461 ===aa===
6462 ====aaa====
6463 ==b==
6464 ===ba===
6465 ===bb===
6466 ====bba====
6467 ===bc===
6468 ==c==
6469 ===ca===
6470 !! result
6471 start
6472 ==a==
6473 ===aa===
6474 ====aaa====
6475 ==b==
6476 ===ba===
6477 ===bb===
6478 xxx
6479
6480 ===bc===
6481 ==c==
6482 ===ca===
6483 !! end
6484
6485 !! test
6486 Section replacement test (section 8)
6487 !! options
6488 replace=8,"xxx"
6489 !! input
6490 start
6491 ==a==
6492 ===aa===
6493 ====aaa====
6494 ==b==
6495 ===ba===
6496 ===bb===
6497 ====bba====
6498 ===bc===
6499 ==c==
6500 ===ca===
6501 !! result
6502 start
6503 ==a==
6504 ===aa===
6505 ====aaa====
6506 ==b==
6507 ===ba===
6508 ===bb===
6509 ====bba====
6510 xxx
6511
6512 ==c==
6513 ===ca===
6514 !!end
6515
6516 !! test
6517 Section replacement test (section 9)
6518 !! options
6519 replace=9,"xxx"
6520 !! input
6521 start
6522 ==a==
6523 ===aa===
6524 ====aaa====
6525 ==b==
6526 ===ba===
6527 ===bb===
6528 ====bba====
6529 ===bc===
6530 ==c==
6531 ===ca===
6532 !! result
6533 start
6534 ==a==
6535 ===aa===
6536 ====aaa====
6537 ==b==
6538 ===ba===
6539 ===bb===
6540 ====bba====
6541 ===bc===
6542 xxx
6543 !! end
6544
6545 !! test
6546 Section replacement test (section 10)
6547 !! options
6548 replace=10,"xxx"
6549 !! input
6550 start
6551 ==a==
6552 ===aa===
6553 ====aaa====
6554 ==b==
6555 ===ba===
6556 ===bb===
6557 ====bba====
6558 ===bc===
6559 ==c==
6560 ===ca===
6561 !! result
6562 start
6563 ==a==
6564 ===aa===
6565 ====aaa====
6566 ==b==
6567 ===ba===
6568 ===bb===
6569 ====bba====
6570 ===bc===
6571 ==c==
6572 xxx
6573 !! end
6574
6575 !! test
6576 Section replacement test with initial whitespace (bug 13728)
6577 !! options
6578 replace=2,"xxx"
6579 !! input
6580 Preformatted initial line
6581 ==a==
6582 ===a===
6583 !! result
6584 Preformatted initial line
6585 ==a==
6586 xxx
6587 !! end
6588
6589
6590 !! test
6591 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6592 !! options
6593 section=1
6594 !! input
6595 ==a==
6596 a
6597 !! result
6598 ==a==
6599 a
6600 !! end
6601
6602 !! test
6603 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6604 !! options
6605 section=1
6606 !! input
6607 ==a==
6608 a
6609 !! result
6610 ==a==
6611 a
6612 !! end
6613
6614
6615 !! test
6616 Section extraction, <pre> around bogus header (bug 10309)
6617 !! options
6618 noxml section=2
6619 !! input
6620 == Section One ==
6621 <pre>
6622 =======
6623 </pre>
6624
6625 == Section Two ==
6626 stuff
6627 !! result
6628 == Section Two ==
6629 stuff
6630 !! end
6631
6632 !! test
6633 Section replacement, <pre> around bogus header (bug 10309)
6634 !! options
6635 noxml replace=2,"xxx"
6636 !! input
6637 == Section One ==
6638 <pre>
6639 =======
6640 </pre>
6641
6642 == Section Two ==
6643 stuff
6644 !! result
6645 == Section One ==
6646 <pre>
6647 =======
6648 </pre>
6649
6650 xxx
6651 !! end
6652
6653
6654
6655 !! test
6656 Handling of &#x0A; in URLs
6657 !! input
6658 **irc://&#x0A;a
6659 !! result
6660 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
6661 </li></ul>
6662 </li></ul>
6663
6664 !!end
6665
6666 !! test
6667 5 quotes, code coverage +1 line
6668 !! input
6669 '''''
6670 !! result
6671 !! end
6672
6673 !! test
6674 Special:Search page linking.
6675 !! input
6676 {{Special:search}}
6677 !! result
6678 <p><a href="/wiki/Special:Search">Special:Search</a>
6679 </p>
6680 !! end
6681
6682 !! test
6683 Say the magic word
6684 !! input
6685 * {{PAGENAME}}
6686 * {{BASEPAGENAME}}
6687 * {{SUBPAGENAME}}
6688 * {{SUBPAGENAMEE}}
6689 * {{BASEPAGENAME}}
6690 * {{BASEPAGENAMEE}}
6691 * {{TALKPAGENAME}}
6692 * {{TALKPAGENAMEE}}
6693 * {{SUBJECTPAGENAME}}
6694 * {{SUBJECTPAGENAMEE}}
6695 * {{NAMESPACEE}}
6696 * {{NAMESPACE}}
6697 * {{TALKSPACE}}
6698 * {{TALKSPACEE}}
6699 * {{SUBJECTSPACE}}
6700 * {{SUBJECTSPACEE}}
6701 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6702 !! result
6703 <ul><li> Parser test
6704 </li><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> Talk:Parser test
6710 </li><li> Talk:Parser_test
6711 </li><li> Parser test
6712 </li><li> Parser_test
6713 </li><li>
6714 </li><li>
6715 </li><li> Talk
6716 </li><li> Talk
6717 </li><li>
6718 </li><li>
6719 </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>
6720 </li></ul>
6721
6722 !! end
6723 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6724
6725 !! test
6726 Gallery
6727 !! input
6728 <gallery>
6729 image1.png |
6730 image2.gif|||||
6731
6732 image3|
6733 image4 |300px| centre
6734 image5.svg| http://///////
6735 [[x|xx]]]]
6736 * image6
6737 </gallery>
6738 !! result
6739 <ul class="gallery">
6740 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6741 <div style="height: 150px;">Image1.png</div>
6742 <div class="gallerytext">
6743 </div>
6744 </div></li>
6745 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6746 <div style="height: 150px;">Image2.gif</div>
6747 <div class="gallerytext">
6748 <p>||||
6749 </p>
6750 </div>
6751 </div></li>
6752 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6753 <div style="height: 150px;">Image3</div>
6754 <div class="gallerytext">
6755 </div>
6756 </div></li>
6757 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6758 <div style="height: 150px;">Image4</div>
6759 <div class="gallerytext">
6760 <p>300px| centre
6761 </p>
6762 </div>
6763 </div></li>
6764 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6765 <div style="height: 150px;">Image5.svg</div>
6766 <div class="gallerytext">
6767 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
6768 </p>
6769 </div>
6770 </div></li>
6771 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6772 <div style="height: 150px;">* image6</div>
6773 <div class="gallerytext">
6774 </div>
6775 </div></li>
6776 </ul>
6777
6778 !! end
6779
6780 !! test
6781 Gallery (with options)
6782 !! input
6783 <gallery widths='60px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
6784 File:Nonexistant.jpg|caption
6785 File:Nonexistant.jpg
6786 image:foobar.jpg|some '''caption''' [[Main Page]]
6787 image:foobar.jpg
6788 </gallery>
6789 !! result
6790 <ul class="gallery" style="max-width: 202px;_width: 202px;">
6791 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page">Main Page</a></li>
6792 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6793 <div style="height: 70px;">Nonexistant.jpg</div>
6794 <div class="gallerytext">
6795 <p>caption
6796 </p>
6797 </div>
6798 </div></li>
6799 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6800 <div style="height: 70px;">Nonexistant.jpg</div>
6801 <div class="gallerytext">
6802 </div>
6803 </div></li>
6804 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6805 <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>
6806 <div class="gallerytext">
6807 <p>some <b>caption</b> <a href="/wiki/Main_Page">Main Page</a>
6808 </p>
6809 </div>
6810 </div></li>
6811 <li class="gallerybox" style="width: 95px"><div style="width: 95px">
6812 <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>
6813 <div class="gallerytext">
6814 </div>
6815 </div></li>
6816 </ul>
6817
6818 !! end
6819
6820 !! test
6821 gallery (with showfilename option)
6822 !! input
6823 <gallery showfilename>
6824 File:Nonexistant.jpg|caption
6825 File:Nonexistant.jpg
6826 image:foobar.jpg|some '''caption''' [[Main Page]]
6827 File:Foobar.jpg
6828 </gallery>
6829 !! result
6830 <ul class="gallery">
6831 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6832 <div style="height: 150px;">Nonexistant.jpg</div>
6833 <div class="gallerytext">
6834 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6835 caption
6836 </p>
6837 </div>
6838 </div></li>
6839 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6840 <div style="height: 150px;">Nonexistant.jpg</div>
6841 <div class="gallerytext">
6842 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
6843 </p>
6844 </div>
6845 </div></li>
6846 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6847 <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>
6848 <div class="gallerytext">
6849 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6850 some <b>caption</b> <a href="/wiki/Main_Page">Main Page</a>
6851 </p>
6852 </div>
6853 </div></li>
6854 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6855 <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>
6856 <div class="gallerytext">
6857 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
6858 </p>
6859 </div>
6860 </div></li>
6861 </ul>
6862
6863 !! end
6864
6865 !! test
6866 Gallery (with namespace-less filenames)
6867 !! input
6868 <gallery>
6869 File:Nonexistant.jpg
6870 Nonexistant.jpg
6871 image:foobar.jpg
6872 foobar.jpg
6873 </gallery>
6874 !! result
6875 <ul class="gallery">
6876 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6877 <div style="height: 150px;">Nonexistant.jpg</div>
6878 <div class="gallerytext">
6879 </div>
6880 </div></li>
6881 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6882 <div style="height: 150px;">Nonexistant.jpg</div>
6883 <div class="gallerytext">
6884 </div>
6885 </div></li>
6886 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6887 <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>
6888 <div class="gallerytext">
6889 </div>
6890 </div></li>
6891 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
6892 <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>
6893 <div class="gallerytext">
6894 </div>
6895 </div></li>
6896 </ul>
6897
6898 !! end
6899
6900 !! test
6901 HTML Hex character encoding (spells the word "JavaScript")
6902 !! input
6903 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6904 !! result
6905 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6906 </p>
6907 !! end
6908
6909 !! test
6910 HTML Hex character encoding bogus encoding (bug 26437 regression check)
6911 !! input
6912 &#xsee;&#XSEE;
6913 !! result
6914 <p>&amp;#xsee;&amp;#XSEE;
6915 </p>
6916 !! end
6917
6918 !! test
6919 HTML Hex character encoding mixed case
6920 !! input
6921 &#xEE;&#Xee;
6922 !! result
6923 <p>&#xee;&#xee;
6924 </p>
6925 !! end
6926
6927 !! test
6928 __FORCETOC__ override
6929 !! input
6930 __NEWSECTIONLINK__
6931 __FORCETOC__
6932 !! result
6933 <p><br />
6934 </p>
6935 !! end
6936
6937 !! test
6938 ISBN code coverage
6939 !! input
6940 ISBN 978-0-1234-56&#x20;789
6941 !! result
6942 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
6943 </p>
6944 !! end
6945
6946 !! test
6947 ISBN followed by 5 spaces
6948 !! input
6949 ISBN
6950 !! result
6951 <p>ISBN
6952 </p>
6953 !! end
6954
6955 !! test
6956 Double ISBN
6957 !! input
6958 ISBN ISBN 1234567890
6959 !! result
6960 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
6961 </p>
6962 !! end
6963
6964 !! test
6965 Bug 22905: <abbr> followed by ISBN followed by </a>
6966 !! input
6967 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
6968 !! result
6969 <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>
6970 </p>
6971 !! end
6972
6973 !! test
6974 Double RFC
6975 !! input
6976 RFC RFC 1234
6977 !! result
6978 <p>RFC <a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
6979 </p>
6980 !! end
6981
6982 !! test
6983 Double RFC with a wiki link
6984 !! input
6985 RFC [[RFC 1234]]
6986 !! result
6987 <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>
6988 </p>
6989 !! end
6990
6991 !! test
6992 RFC code coverage
6993 !! input
6994 RFC 983&#x20;987
6995 !! result
6996 <p><a class="external mw-magiclink-rfc" href="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
6997 </p>
6998 !! end
6999
7000 !! test
7001 Centre-aligned image
7002 !! input
7003 [[Image:foobar.jpg|centre]]
7004 !! result
7005 <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>
7006
7007 !!end
7008
7009 !! test
7010 None-aligned image
7011 !! input
7012 [[Image:foobar.jpg|none]]
7013 !! result
7014 <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>
7015
7016 !!end
7017
7018 !! test
7019 Width + Height sized image (using px) (height is ignored)
7020 !! input
7021 [[Image:foobar.jpg|640x480px]]
7022 !! result
7023 <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>
7024 </p>
7025 !!end
7026
7027 !! test
7028 Width-sized image (using px, no following whitespace)
7029 !! input
7030 [[Image:foobar.jpg|640px]]
7031 !! result
7032 <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>
7033 </p>
7034 !!end
7035
7036 !! test
7037 Width-sized image (using px, with following whitespace - test regression from r39467)
7038 !! input
7039 [[Image:foobar.jpg|640px ]]
7040 !! result
7041 <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>
7042 </p>
7043 !!end
7044
7045 !! test
7046 Width-sized image (using px, with preceding whitespace - test regression from r39467)
7047 !! input
7048 [[Image:foobar.jpg| 640px]]
7049 !! result
7050 <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>
7051 </p>
7052 !!end
7053
7054 !! test
7055 Another italics / bold test
7056 !! input
7057 ''' ''x'
7058 !! result
7059 <pre>'<i> </i>x'
7060 </pre>
7061 !!end
7062
7063 # Note the results may be incorrect, as parserTest output included this:
7064 # XML error: Mismatched tag at byte 6120:
7065 # ...<dd> </dt></dl> </dd...
7066 !! test
7067 dt/dd/dl test
7068 !! options
7069 disabled
7070 !! input
7071 :;;;::
7072 !! result
7073 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
7074 </dd></dl>
7075 </dd></dl>
7076 </dt></dl>
7077 </dt></dl>
7078 </dt></dl>
7079 </dd></dl>
7080
7081 !!end
7082
7083
7084 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
7085 !! test
7086 Images with the "|" character in the comment
7087 !! input
7088 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
7089 !! result
7090 <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>
7091
7092 !!end
7093
7094 !! test
7095 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
7096 !! input
7097 <html><script>alert(1);</script></html>
7098 !! result
7099 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
7100 </p>
7101 !! end
7102
7103 !! test
7104 HTML with raw HTML ($wgRawHtml==true)
7105 !! options
7106 rawhtml
7107 !! input
7108 <html><script>alert(1);</script></html>
7109 !! result
7110 <p><script>alert(1);</script>
7111 </p>
7112 !! end
7113
7114 !! test
7115 Parents of subpages, one level up
7116 !! options
7117 subpage title=[[Subpage test/L1/L2/L3]]
7118 !! input
7119 [[../|L2]]
7120 !! result
7121 <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>
7122 </p>
7123 !! end
7124
7125
7126 !! test
7127 Parents of subpages, one level up, not named
7128 !! options
7129 subpage title=[[Subpage test/L1/L2/L3]]
7130 !! input
7131 [[../]]
7132 !! result
7133 <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>
7134 </p>
7135 !! end
7136
7137
7138
7139 !! test
7140 Parents of subpages, two levels up
7141 !! options
7142 subpage title=[[Subpage test/L1/L2/L3]]
7143 !! input
7144 [[../../|L1]]2
7145
7146 [[../../|L1]]l
7147 !! result
7148 <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
7149 </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>
7150 </p>
7151 !! end
7152
7153 !! test
7154 Parents of subpages, two levels up, without trailing slash or name.
7155 !! options
7156 subpage title=[[Subpage test/L1/L2/L3]]
7157 !! input
7158 [[../..]]
7159 !! result
7160 <p>[[../..]]
7161 </p>
7162 !! end
7163
7164 !! test
7165 Parents of subpages, two levels up, with lots of extra trailing slashes.
7166 !! options
7167 subpage title=[[Subpage test/L1/L2/L3]]
7168 !! input
7169 [[../../////]]
7170 !! result
7171 <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>
7172 </p>
7173 !! end
7174
7175 !! test
7176 Definition list code coverage
7177 !! input
7178 ; title : def
7179 ; title : def
7180 ;title: def
7181 !! result
7182 <dl><dt> title &#160;</dt><dd> def
7183 </dd><dt> title&#160;</dt><dd> def
7184 </dd><dt>title</dt><dd> def
7185 </dd></dl>
7186
7187 !! end
7188
7189 !! test
7190 Don't fall for the self-closing div
7191 !! input
7192 <div>hello world</div/>
7193 !! result
7194 <div>hello world</div>
7195
7196 !! end
7197
7198 !! test
7199 MSGNW magic word
7200 !! input
7201 {{MSGNW:msg}}
7202 !! result
7203 <p>&#91;&#91;:Template:Msg&#93;&#93;
7204 </p>
7205 !! end
7206
7207 !! test
7208 RAW magic word
7209 !! input
7210 {{RAW:QUERTY}}
7211 !! result
7212 <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>
7213 </p>
7214 !! end
7215
7216 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
7217 !! test
7218 Always escape literal '>' in output, not just after '<'
7219 !! input
7220 ><>
7221 !! result
7222 <p>&gt;&lt;&gt;
7223 </p>
7224 !! end
7225
7226 !! test
7227 Template caching
7228 !! input
7229 {{Test}}
7230 {{Test}}
7231 !! result
7232 <p>This is a test template
7233 This is a test template
7234 </p>
7235 !! end
7236
7237
7238 !! article
7239 MediaWiki:Fake
7240 !! text
7241 ==header==
7242 !! endarticle
7243
7244 !! test
7245 Inclusion of !userCanEdit() content
7246 !! input
7247 {{MediaWiki:Fake}}
7248 !! result
7249 <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>
7250
7251 !! end
7252
7253
7254 !! test
7255 Out-of-order TOC heading levels
7256 !! input
7257 ==2==
7258 ======6======
7259 ===3===
7260 =1=
7261 =====5=====
7262 ==2==
7263 !! result
7264 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7265 <ul>
7266 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
7267 <ul>
7268 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
7269 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
7270 </ul>
7271 </li>
7272 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
7273 <ul>
7274 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
7275 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
7276 </ul>
7277 </li>
7278 </ul>
7279 </td></tr></table>
7280 <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>
7281 <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>
7282 <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>
7283 <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>
7284 <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>
7285 <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>
7286
7287 !! end
7288
7289
7290 !! test
7291 ISBN with a dummy number
7292 !! input
7293 ISBN ---
7294 !! result
7295 <p>ISBN ---
7296 </p>
7297 !! end
7298
7299
7300 !! test
7301 ISBN with space-delimited number
7302 !! input
7303 ISBN 92 9017 032 8
7304 !! result
7305 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
7306 </p>
7307 !! end
7308
7309
7310 !! test
7311 ISBN with multiple spaces, no number
7312 !! input
7313 ISBN foo
7314 !! result
7315 <p>ISBN foo
7316 </p>
7317 !! end
7318
7319
7320 !! test
7321 ISBN length
7322 !! input
7323 ISBN 123456789
7324
7325 ISBN 1234567890
7326
7327 ISBN 12345678901
7328 !! result
7329 <p>ISBN 123456789
7330 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7331 </p><p>ISBN 12345678901
7332 </p>
7333 !! end
7334
7335
7336 !! test
7337 ISBN with trailing year (bug 8110)
7338 !! input
7339 ISBN 1-234-56789-0 - 2006
7340
7341 ISBN 1 234 56789 0 - 2006
7342 !! result
7343 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
7344 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
7345 </p>
7346 !! end
7347
7348
7349 !! test
7350 anchorencode
7351 !! input
7352 {{anchorencode:foo bar©#%n}}
7353 !! result
7354 <p>foo_bar.C2.A9.23.25n
7355 </p>
7356 !! end
7357
7358 !! test
7359 anchorencode trims spaces
7360 !! input
7361 {{anchorencode: __pretty__please__}}
7362 !! result
7363 <p>pretty_please
7364 </p>
7365 !! end
7366
7367 !! test
7368 anchorencode deals with links
7369 !! input
7370 {{anchorencode: [[hello|world]] [[hi]]}}
7371 !! result
7372 <p>world_hi
7373 </p>
7374 !! end
7375
7376 !! test
7377 anchorencode deals with templates
7378 !! input
7379 {{anchorencode: {{Foo}} }}
7380 !! result
7381 <p>FOO
7382 </p>
7383 !! end
7384
7385 !! test
7386 anchorencode encodes like the TOC generator: (bug 18431)
7387 !! input
7388 === _ +:.3A%3A&&amp;]] ===
7389 {{anchorencode: _ +:.3A%3A&&amp;]] }}
7390 __NOEDITSECTION__
7391 !! result
7392 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
7393 <p>.2B:.3A.253A.26.26.5D.5D
7394 </p>
7395 !! end
7396
7397 # Expected output in the following test is not necessarily expected (there
7398 # should probably be <p> tags inside the <blockquote> in the output) -- it's
7399 # only testing for well-formedness.
7400 !! test
7401 Bug 6200: blockquotes and paragraph formatting
7402 !! input
7403 <blockquote>
7404 foo
7405 </blockquote>
7406
7407 bar
7408
7409 baz
7410 !! result
7411 <blockquote>
7412 foo
7413 </blockquote>
7414 <p>bar
7415 </p>
7416 <pre>baz
7417 </pre>
7418 !! end
7419
7420 !! test
7421 Bug 8293: Use of center tag ruins paragraph formatting
7422 !! input
7423 <center>
7424 foo
7425 </center>
7426
7427 bar
7428
7429 baz
7430 !! result
7431 <center>
7432 <p>foo
7433 </p>
7434 </center>
7435 <p>bar
7436 </p>
7437 <pre>baz
7438 </pre>
7439 !! end
7440
7441
7442 ###
7443 ### Language variants related tests
7444 ###
7445 !! test
7446 Self-link in language variants
7447 !! options
7448 title=[[Dunav]] language=sr
7449 !! input
7450 Both [[Dunav]] and [[Дунав]] are names for this river.
7451 !! result
7452 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
7453 </p>
7454 !!end
7455
7456
7457 !! test
7458 Link to pages in language variants
7459 !! options
7460 language=sr
7461 !! input
7462 Main Page can be written as [[Маин Паге]]
7463 !! result
7464 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
7465 </p>
7466 !!end
7467
7468
7469 !! test
7470 Multiple links to pages in language variants
7471 !! options
7472 language=sr
7473 !! input
7474 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
7475 !! result
7476 <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>.
7477 </p>
7478 !!end
7479
7480
7481 !! test
7482 Simple template in language variants
7483 !! options
7484 language=sr
7485 !! input
7486 {{тест}}
7487 !! result
7488 <p>This is a test template
7489 </p>
7490 !! end
7491
7492
7493 !! test
7494 Template with explicit namespace in language variants
7495 !! options
7496 language=sr
7497 !! input
7498 {{Template:тест}}
7499 !! result
7500 <p>This is a test template
7501 </p>
7502 !! end
7503
7504
7505 !! test
7506 Basic test for template parameter in language variants
7507 !! options
7508 language=sr
7509 !! input
7510 {{парамтест|param=foo}}
7511 !! result
7512 <p>This is a test template with parameter foo
7513 </p>
7514 !! end
7515
7516
7517 !! test
7518 Simple category in language variants
7519 !! options
7520 language=sr cat
7521 !! input
7522 [[Category:МедиаWики Усер'с Гуиде]]
7523 !! result
7524 <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>
7525 !! end
7526
7527
7528 !! test
7529 Stripping -{}- tags (language variants)
7530 !! options
7531 language=sr
7532 !! input
7533 Latin proverb: -{Ne nuntium necare}-
7534 !! result
7535 <p>Latin proverb: Ne nuntium necare
7536 </p>
7537 !! end
7538
7539
7540 !! test
7541 Prevent conversion with -{}- tags (language variants)
7542 !! options
7543 language=sr variant=sr-ec
7544 !! input
7545 Latinski: -{Ne nuntium necare}-
7546 !! result
7547 <p>Латински: Ne nuntium necare
7548 </p>
7549 !! end
7550
7551
7552 !! test
7553 Prevent conversion of text with -{}- tags (language variants)
7554 !! options
7555 language=sr variant=sr-ec
7556 !! input
7557 Latinski: -{Ne nuntium necare}-
7558 !! result
7559 <p>Латински: Ne nuntium necare
7560 </p>
7561 !! end
7562
7563
7564 !! test
7565 Prevent conversion of links with -{}- tags (language variants)
7566 !! options
7567 language=sr variant=sr-ec
7568 !! input
7569 -{[[Main Page]]}-
7570 !! result
7571 <p><a href="/wiki/Main_Page">Main Page</a>
7572 </p>
7573 !! end
7574
7575
7576 !! test
7577 -{}- tags within headlines (within html for parserConvert())
7578 !! options
7579 language=sr variant=sr-ec
7580 !! input
7581 == -{Naslov}- ==
7582 !! result
7583 <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>
7584
7585 !! end
7586
7587
7588 !! test
7589 Explicit definition of language variant alternatives
7590 !! options
7591 language=zh variant=zh-tw
7592 !! input
7593 -{zh:China;zh-tw:Taiwan}-, not China
7594 !! result
7595 <p>Taiwan, not China
7596 </p>
7597 !! end
7598
7599
7600 !! test
7601 Explicit session-wise language variant mapping (A flag and - flag)
7602 !! options
7603 language=zh variant=zh-tw
7604 !! input
7605 Taiwan is not China.
7606 But -{A|zh:China;zh-tw:Taiwan}- is China,
7607 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
7608 and -{China}- is China.
7609 !! result
7610 <p>Taiwan is not China.
7611 But Taiwan is Taiwan,
7612 (This should be stripped!)
7613 and China is China.
7614 </p>
7615 !! end
7616
7617 !! test
7618 Explicit session-wise language variant mapping (H flag for hide)
7619 !! options
7620 language=zh variant=zh-tw
7621 !! input
7622 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
7623 Taiwan is China.
7624 !! result
7625 <p>(This should be stripped!)
7626 Taiwan is Taiwan.
7627 </p>
7628 !! end
7629
7630 !! test
7631 Adding explicit conversion rule for title (T flag)
7632 !! options
7633 language=zh variant=zh-tw showtitle
7634 !! input
7635 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7636 !! result
7637 Taiwan
7638 <p>Should be stripped!
7639 </p>
7640 !! end
7641
7642 !! test
7643 Testing that changing the language variant here in the tests actually works
7644 !! options
7645 language=zh variant=zh showtitle
7646 !! input
7647 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7648 !! result
7649 China
7650 <p>Should be stripped!
7651 </p>
7652 !! end
7653
7654 !! test
7655 Bug 24072: more test on conversion rule for title
7656 !! options
7657 language=zh variant=zh-tw showtitle
7658 !! input
7659 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7660 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
7661 !! result
7662 Taiwan
7663 <p>This should be stripped!
7664 This won't take interferes with the title rule.
7665 </p>
7666 !! end
7667
7668 !! test
7669 Raw output of variant escape tags (R flag)
7670 !! options
7671 language=zh variant=zh-tw
7672 !! input
7673 Raw: -{R|zh:China;zh-tw:Taiwan}-
7674 !! result
7675 <p>Raw: zh:China;zh-tw:Taiwan
7676 </p>
7677 !! end
7678
7679 !! test
7680 Nested using of manual convert syntax
7681 !! options
7682 language=zh variant=zh-hk
7683 !! input
7684 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
7685 !! result
7686 <p>Nested: Hello Hong Kong!
7687 </p>
7688 !! end
7689
7690 !! test
7691 Do not convert roman numbers to language variants
7692 !! options
7693 language=sr variant=sr-ec
7694 !! input
7695 Fridrih IV je car.
7696 !! result
7697 <p>Фридрих IV је цар.
7698 </p>
7699 !! end
7700
7701 !! test
7702 Unclosed language converter markup "-{"
7703 !! options
7704 language=sr
7705 !! input
7706 -{T|hello
7707 !! result
7708 <p>-{T|hello
7709 </p>
7710 !! end
7711
7712 !! test
7713 Don't convert raw rule "-{R|=&gt;}-" to "=>"
7714 !! options
7715 language=sr
7716 !! input
7717 -{R|=&gt;}-
7718 !! result
7719 <p>=&gt;
7720 </p>
7721 !!end
7722
7723 !!article
7724 Template:Bullet
7725 !!text
7726 * Bar
7727 !!endarticle
7728
7729 !! test
7730 Bug 529: Uncovered bullet
7731 !! input
7732 * Foo {{bullet}}
7733 !! result
7734 <ul><li> Foo
7735 </li><li> Bar
7736 </li></ul>
7737
7738 !! end
7739
7740 !! test
7741 Bug 529: Uncovered table already at line-start
7742 !! input
7743 x
7744
7745 {{table}}
7746 y
7747 !! result
7748 <p>x
7749 </p>
7750 <table>
7751 <tr>
7752 <td>1</td>
7753 <td>2</td>
7754 </tr>
7755 <tr>
7756 <td>3</td>
7757 <td>4</td>
7758 </tr></table>
7759 <p>y
7760 </p>
7761 !! end
7762
7763 !! test
7764 Bug 529: Uncovered bullet in parser function result
7765 !! input
7766 * Foo {{lc:{{bullet}} }}
7767 !! result
7768 <ul><li> Foo
7769 </li><li> bar
7770 </li></ul>
7771
7772 !! end
7773
7774 !! test
7775 Bug 5678: Double-parsed template argument
7776 !! input
7777 {{lc:{{{1}}}|hello}}
7778 !! result
7779 <p>{{{1}}}
7780 </p>
7781 !! end
7782
7783 !! test
7784 Bug 5678: Double-parsed template invocation
7785 !! input
7786 {{lc:{{paramtest {{!}} param = hello }} }}
7787 !! result
7788 <p>{{paramtest | param = hello }}
7789 </p>
7790 !! end
7791
7792 !! test
7793 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
7794 !! options
7795 language=cs
7796 title=[[Main Page]]
7797 !! input
7798 {{PRVNÍVELKÉ:ěščř}}
7799 {{prvnívelké:ěščř}}
7800 {{PRVNÍMALÉ:ěščř}}
7801 {{prvnímalé:ěščř}}
7802 {{MALÁ:ěščř}}
7803 {{malá:ěščř}}
7804 {{VELKÁ:ěščř}}
7805 {{velká:ěščř}}
7806 !! result
7807 <p>Ěščř
7808 Ěščř
7809 ěščř
7810 ěščř
7811 ěščř
7812 ěščř
7813 ĚŠČŘ
7814 ĚŠČŘ
7815 </p>
7816 !! end
7817
7818 !! test
7819 Morwen/13: Unclosed link followed by heading
7820 !! input
7821 [[link
7822 ==heading==
7823 !! result
7824 <p>[[link
7825 </p>
7826 <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>
7827
7828 !! end
7829
7830 !! test
7831 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
7832 !! input
7833 {{foo|
7834 =heading=
7835 !! result
7836 <p>{{foo|
7837 </p>
7838 <h1> <span class="mw-headline" id="heading">heading</span></h1>
7839
7840 !! end
7841
7842 !! test
7843 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
7844 !! input
7845 {{foo|
7846 ==heading==
7847 !! result
7848 <p>{{foo|
7849 </p>
7850 <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>
7851
7852 !! end
7853
7854 !! test
7855 Tildes in comments
7856 !! options
7857 pst
7858 !! input
7859 <!-- ~~~~ -->
7860 !! result
7861 <!-- ~~~~ -->
7862 !! end
7863
7864 !! test
7865 Paragraphs inside divs (no extra line breaks)
7866 !! input
7867 <div>Line one
7868
7869 Line two</div>
7870 !! result
7871 <div>Line one
7872 Line two</div>
7873
7874 !! end
7875
7876 !! test
7877 Paragraphs inside divs (extra line break on open)
7878 !! input
7879 <div>
7880 Line one
7881
7882 Line two</div>
7883 !! result
7884 <div>
7885 <p>Line one
7886 </p>
7887 Line two</div>
7888
7889 !! end
7890
7891 !! test
7892 Paragraphs inside divs (extra line break on close)
7893 !! input
7894 <div>Line one
7895
7896 Line two
7897 </div>
7898 !! result
7899 <div>Line one
7900 <p>Line two
7901 </p>
7902 </div>
7903
7904 !! end
7905
7906 !! test
7907 Paragraphs inside divs (extra line break on open and close)
7908 !! input
7909 <div>
7910 Line one
7911
7912 Line two
7913 </div>
7914 !! result
7915 <div>
7916 <p>Line one
7917 </p><p>Line two
7918 </p>
7919 </div>
7920
7921 !! end
7922
7923 !! test
7924 Nesting tags, paragraphs on lines which begin with <div>
7925 !! options
7926 disabled
7927 !! input
7928 <div></div><strong>A
7929 B</strong>
7930 !! result
7931 <div></div>
7932 <p><strong>A
7933 B</strong>
7934 </p>
7935 !! end
7936
7937 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7938 !! test
7939 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7940 !! options
7941 disabled
7942 !! input
7943 <blockquote>Line one
7944
7945 Line two</blockquote>
7946 !! result
7947 <blockquote>Line one
7948 Line two</blockquote>
7949
7950 !! end
7951
7952 !! test
7953 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7954 !! options
7955 disabled
7956 !! input
7957 <blockquote>
7958 Line one
7959
7960 Line two</blockquote>
7961 !! result
7962 <blockquote>
7963 <p>Line one
7964 </p>
7965 Line two</blockquote>
7966
7967 !! end
7968
7969 !! test
7970 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7971 !! options
7972 disabled
7973 !! input
7974 <blockquote>Line one
7975
7976 Line two
7977 </blockquote>
7978 !! result
7979 <blockquote>Line one
7980 <p>Line two
7981 </p>
7982 </blockquote>
7983
7984 !! end
7985
7986 !! test
7987 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7988 !! options
7989 disabled
7990 !! input
7991 <blockquote>
7992 Line one
7993
7994 Line two
7995 </blockquote>
7996 !! result
7997 <blockquote>
7998 <p>Line one
7999 </p><p>Line two
8000 </p>
8001 </blockquote>
8002
8003 !! end
8004
8005 !! test
8006 Paragraphs inside blockquotes/divs (no extra line breaks)
8007 !! input
8008 <blockquote><div>Line one
8009
8010 Line two</div></blockquote>
8011 !! result
8012 <blockquote><div>Line one
8013 Line two</div></blockquote>
8014
8015 !! end
8016
8017 !! test
8018 Paragraphs inside blockquotes/divs (extra line break on open)
8019 !! input
8020 <blockquote><div>
8021 Line one
8022
8023 Line two</div></blockquote>
8024 !! result
8025 <blockquote><div>
8026 <p>Line one
8027 </p>
8028 Line two</div></blockquote>
8029
8030 !! end
8031
8032 !! test
8033 Paragraphs inside blockquotes/divs (extra line break on close)
8034 !! input
8035 <blockquote><div>Line one
8036
8037 Line two
8038 </div></blockquote>
8039 !! result
8040 <blockquote><div>Line one
8041 <p>Line two
8042 </p>
8043 </div></blockquote>
8044
8045 !! end
8046
8047 !! test
8048 Paragraphs inside blockquotes/divs (extra line break on open and close)
8049 !! input
8050 <blockquote><div>
8051 Line one
8052
8053 Line two
8054 </div></blockquote>
8055 !! result
8056 <blockquote><div>
8057 <p>Line one
8058 </p><p>Line two
8059 </p>
8060 </div></blockquote>
8061
8062 !! end
8063
8064 !! test
8065 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
8066 !! options
8067 wgLinkHolderBatchSize=0
8068 !! input
8069 [[meatball:1]]
8070 [[meatball:2]]
8071 [[meatball:3]]
8072 !! result
8073 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw">meatball:1</a>
8074 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw">meatball:2</a>
8075 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw">meatball:3</a>
8076 </p>
8077 !! end
8078
8079 !! test
8080 Free external link invading image caption
8081 !! input
8082 [[Image:Foobar.jpg|thumb|http://x|hello]]
8083 !! result
8084 <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>
8085
8086 !! end
8087
8088 !! test
8089 Bug 15196: localised external link numbers
8090 !! options
8091 language=fa
8092 !! input
8093 [http://en.wikipedia.org/]
8094 !! result
8095 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
8096 </p>
8097 !! end
8098
8099 !! test
8100 Multibyte character in padleft
8101 !! input
8102 {{padleft:-Hello|7|Æ}}
8103 !! result
8104 <p>Æ-Hello
8105 </p>
8106 !! end
8107
8108 !! test
8109 Multibyte character in padright
8110 !! input
8111 {{padright:Hello-|7|Æ}}
8112 !! result
8113 <p>Hello-Æ
8114 </p>
8115 !! end
8116
8117 !! test
8118 Formatted date
8119 !! config
8120 wgUseDynamicDates=1
8121 !! input
8122 [[2009-03-24]]
8123 !! result
8124 <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>
8125 </p>
8126 !!end
8127
8128 !!test
8129 formatdate parser function
8130 !!input
8131 {{#formatdate:2009-03-24}}
8132 !! result
8133 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
8134 </p>
8135 !! end
8136
8137 !!test
8138 formatdate parser function, with default format
8139 !!input
8140 {{#formatdate:2009-03-24|mdy}}
8141 !! result
8142 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
8143 </p>
8144 !! end
8145
8146 !! test
8147 Linked date with autoformatting disabled
8148 !! config
8149 wgUseDynamicDates=false
8150 !! input
8151 [[2009-03-24]]
8152 !! result
8153 <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>
8154 </p>
8155 !! end
8156
8157 !! test
8158 Spacing of numbers in formatted dates
8159 !! input
8160 {{#formatdate:January 15}}
8161 !! result
8162 <p><span class="mw-formatted-date" title="01-15">January 15</span>
8163 </p>
8164 !! end
8165
8166 !! test
8167 Spacing of numbers in formatted dates (linked)
8168 !! config
8169 wgUseDynamicDates=true
8170 !! input
8171 [[January 15]]
8172 !! result
8173 <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>
8174 </p>
8175 !! end
8176
8177 #
8178 #
8179 #
8180
8181 #
8182 # Edit comments
8183 #
8184
8185 !! test
8186 Edit comment with link
8187 !! options
8188 comment
8189 !! input
8190 I like the [[Main Page]] a lot
8191 !! result
8192 I like the <a href="/wiki/Main_Page">Main Page</a> a lot
8193 !!end
8194
8195 !! test
8196 Edit comment with link and link text
8197 !! options
8198 comment
8199 !! input
8200 I like the [[Main Page|best pages]] a lot
8201 !! result
8202 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8203 !!end
8204
8205 !! test
8206 Edit comment with link and link text with suffix
8207 !! options
8208 comment
8209 !! input
8210 I like the [[Main Page|best page]]s a lot
8211 !! result
8212 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8213 !!end
8214
8215 !! test
8216 Edit comment with section link (non-local, eg in history list)
8217 !! options
8218 comment title=[[Main Page]]
8219 !! input
8220 /* External links */ removed bogus entries
8221 !! result
8222 <span class="autocomment"><a href="/wiki/Main_Page#External_links" title="Main Page">→</a>External links: </span> removed bogus entries
8223 !!end
8224
8225 !! test
8226 Edit comment with section link (local, eg in diff view)
8227 !! options
8228 comment local title=[[Main Page]]
8229 !! input
8230 /* External links */ removed bogus entries
8231 !! result
8232 <span class="autocomment"><a href="#External_links">→</a>External links: </span> removed bogus entries
8233 !!end
8234
8235 !! test
8236 Edit comment with subpage link (bug 14080)
8237 !! options
8238 comment
8239 subpage
8240 title=[[Subpage test]]
8241 !! input
8242 Poked at a [[/subpage]] here...
8243 !! result
8244 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
8245 !!end
8246
8247 !! test
8248 Edit comment with subpage link and link text (bug 14080)
8249 !! options
8250 comment
8251 subpage
8252 title=[[Subpage test]]
8253 !! input
8254 Poked at a [[/subpage|neat little page]] here...
8255 !! result
8256 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
8257 !!end
8258
8259 !! test
8260 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
8261 !! options
8262 comment
8263 title=[[Subpage test]]
8264 !! input
8265 Poked at a [[/subpage]] here...
8266 !! result
8267 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...
8268 !!end
8269
8270 !! test
8271 Edit comment with bare anchor link (local, as on diff)
8272 !! options
8273 comment
8274 local
8275 title=[[Main Page]]
8276 !!input
8277 [[#section]]
8278 !! result
8279 <a href="#section">#section</a>
8280 !! end
8281
8282 !! test
8283 Edit comment with bare anchor link (non-local, as on history)
8284 !! options
8285 comment
8286 title=[[Main Page]]
8287 !!input
8288 [[#section]]
8289 !! result
8290 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
8291 !! end
8292
8293 !! test
8294 Anchor starting with underscore
8295 !!input
8296 [[#_ref|One]]
8297 !! result
8298 <p><a href="#_ref">One</a>
8299 </p>
8300 !! end
8301
8302 !! test
8303 Id starting with underscore
8304 !!input
8305 <div id="_ref"></div>
8306 !! result
8307 <div id="_ref"></div>
8308
8309 !! end
8310
8311 !! test
8312 Space normalisation on autocomment (bug 22784)
8313 !! options
8314 comment
8315 title=[[Main Page]]
8316 !!input
8317 /* __hello__world__ */
8318 !! result
8319 <span class="autocomment"><a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>__hello__world__</span>
8320 !! end
8321
8322 !! test
8323 percent-encoding and + signs in comments (Bug 26410)
8324 !! options
8325 comment
8326 !!input
8327 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
8328 !! result
8329 <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>
8330 !! end
8331
8332 !! test
8333 Bad images - basic functionality
8334 !! input
8335 [[File:Bad.jpg]]
8336 !! result
8337 !! end
8338
8339 !! test
8340 Bad images - bug 16039: text after bad image disappears
8341 !! input
8342 Foo bar
8343 [[File:Bad.jpg]]
8344 Bar foo
8345 !! result
8346 <p>Foo bar
8347 </p><p>Bar foo
8348 </p>
8349 !! end
8350
8351 !! test
8352 Verify that displaytitle works (bug #22501) no displaytitle
8353 !! options
8354 showtitle
8355 !! config
8356 wgAllowDisplayTitle=true
8357 wgRestrictDisplayTitle=false
8358 !! input
8359 this is not the the title
8360 !! result
8361 Parser test
8362 <p>this is not the the title
8363 </p>
8364 !! end
8365
8366 !! test
8367 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
8368 !! options
8369 showtitle
8370 title=[[Screen]]
8371 !! config
8372 wgAllowDisplayTitle=true
8373 wgRestrictDisplayTitle=false
8374 !! input
8375 this is not the the title
8376 {{DISPLAYTITLE:whatever}}
8377 !! result
8378 whatever
8379 <p>this is not the the title
8380 </p>
8381 !! end
8382
8383 !! test
8384 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
8385 !! options
8386 showtitle
8387 title=[[Screen]]
8388 !! config
8389 wgAllowDisplayTitle=true
8390 wgRestrictDisplayTitle=true
8391 !! input
8392 this is not the the title
8393 {{DISPLAYTITLE:whatever}}
8394 !! result
8395 Screen
8396 <p>this is not the the title
8397 </p>
8398 !! end
8399
8400 !! test
8401 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
8402 !! options
8403 showtitle
8404 title=[[Screen]]
8405 !! config
8406 wgAllowDisplayTitle=true
8407 wgRestrictDisplayTitle=true
8408 !! input
8409 this is not the the title
8410 {{DISPLAYTITLE:screen}}
8411 !! result
8412 screen
8413 <p>this is not the the title
8414 </p>
8415 !! end
8416
8417 !! test
8418 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
8419 !! options
8420 showtitle
8421 title=[[Screen]]
8422 !! config
8423 wgAllowDisplayTitle=false
8424 !! input
8425 this is not the the title
8426 {{DISPLAYTITLE:screen}}
8427 !! result
8428 Screen
8429 <p>this is not the the title
8430 <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>
8431 </p>
8432 !! end
8433
8434 !! test
8435 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
8436 !! options
8437 showtitle
8438 title=[[Screen]]
8439 !! config
8440 wgAllowDisplayTitle=false
8441 !! input
8442 this is not the the title
8443 !! result
8444 Screen
8445 <p>this is not the the title
8446 </p>
8447 !! end
8448
8449 !! test
8450 preload: check <noinclude> and <includeonly>
8451 !! options
8452 preload
8453 !! input
8454 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
8455 !! result
8456 Hello kind world.
8457 !! end
8458
8459 !! test
8460 preload: check <onlyinclude>
8461 !! options
8462 preload
8463 !! input
8464 Goodbye <onlyinclude>Hello world</onlyinclude>
8465 !! result
8466 Hello world
8467 !! end
8468
8469 !! test
8470 preload: can pass tags through if we want to
8471 !! options
8472 preload
8473 !! input
8474 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
8475 !! result
8476 <includeonly>Hello world</includeonly>
8477 !! end
8478
8479 !! test
8480 preload: check that it doesn't try to do tricks
8481 !! options
8482 preload
8483 !! input
8484 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8485 !! result
8486 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8487 !! end
8488
8489 !! test
8490 Play a bit with r67090 and bug 3158
8491 !! options
8492 disabled
8493 !! input
8494 <div style="width:50% !important">&nbsp;</div>
8495 <div style="width:50%&nbsp;!important">&nbsp;</div>
8496 <div style="width:50%&#160;!important">&nbsp;</div>
8497 <div style="border : solid;">&nbsp;</div>
8498 !! result
8499 <div style="width:50% !important">&nbsp;</div>
8500 <div style="width:50% !important">&nbsp;</div>
8501 <div style="width:50% !important">&nbsp;</div>
8502 <div style="border&#160;: solid;">&nbsp;</div>
8503
8504 !! end
8505
8506 !! test
8507 HTML5 data attributes
8508 !! input
8509 <span data-foo="bar">Baz</span>
8510 <p data-abc-def_hij="">Quuz</p>
8511 !! result
8512 <p><span data-foo="bar">Baz</span>
8513 </p>
8514 <p data-abc-def_hij="">Quuz</p>
8515
8516 !! end
8517
8518 !! test
8519 percent-encoding and + signs in internal links (Bug 26410)
8520 !! input
8521 [[User:+%]] [[Page+title%]]
8522 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
8523 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
8524 [[%33%45]] [[%33%45+]]
8525 !! result
8526 <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>
8527 <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>
8528 <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>
8529 <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>
8530 </p>
8531 !! end
8532
8533 !! test
8534 Special characters in embedded file links (bug 27679)
8535 !! input
8536 [[File:Contains & ampersand.jpg]]
8537 [[File:Does not exist.jpg|Title with & ampersand]]
8538 !! result
8539 <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>
8540 <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>
8541 </p>
8542 !! end
8543
8544 !! article
8545 A
8546 !! text
8547 A
8548 !! endarticle
8549
8550 !! article
8551 Ä
8552 !! text
8553 Ä
8554 !! endarticle
8555
8556 !! test
8557 Bug#542 Link text shouldn't be duplicated in title attributes
8558 !! input
8559 [[A]] [[a]] [[Ä]] [[ä]]
8560 !! result
8561 <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>
8562 </p>
8563 !! end
8564
8565 TODO:
8566 more images
8567 more tables
8568 math
8569 character entities
8570 and much more
8571 Try for 100% code coverage