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