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