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