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