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