Merge "Added result properties to action=paraminfo"
[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: trim trailing empty lines
3690 !! options
3691 pst
3692 !! input
3693 Empty lines are trimmed
3694
3695
3696
3697
3698 !! result
3699 Empty lines are trimmed
3700 !! end
3701
3702 !! test
3703 pre-save transform: Signature expansion
3704 !! options
3705 pst
3706 !! input
3707 * ~~~
3708 * <noinclude>~~~</noinclude>
3709 * <includeonly>~~~</includeonly>
3710 * <onlyinclude>~~~</onlyinclude>
3711 !! result
3712 * [[Special:Contributions/127.0.0.1|127.0.0.1]]
3713 * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
3714 * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
3715 * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
3716 !! end
3717
3718
3719 !! test
3720 pre-save transform: Signature expansion in nowiki tags (bug 93)
3721 !! options
3722 pst disabled
3723 !! input
3724 Shall not expand:
3725
3726 <nowiki>~~~~</nowiki>
3727
3728 <includeonly><nowiki>~~~~</nowiki></includeonly>
3729
3730 <noinclude><nowiki>~~~~</nowiki></noinclude>
3731
3732 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
3733
3734 {{subst:Foo}} shall be converted to FOO
3735
3736 As well as inside noinclude/onlyinclude
3737 <noinclude>{{subst:Foo}}</noinclude>
3738 <onlyinclude>{{subst:Foo}}</onlyinclude>
3739
3740 But not inside includeonly
3741 <includeonly>{{subst:Foo}}</includeonly>
3742 !! result
3743 Shall not expand:
3744
3745 <nowiki>~~~~</nowiki>
3746
3747 <includeonly><nowiki>~~~~</nowiki></includeonly>
3748
3749 <noinclude><nowiki>~~~~</nowiki></noinclude>
3750
3751 <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
3752
3753 FOO shall be converted to FOO
3754
3755 As well as inside noinclude/onlyinclude
3756 <noinclude>FOO</noinclude>
3757 <onlyinclude>FOO</onlyinclude>
3758
3759 But not inside includeonly
3760 <includeonly>{{subst:Foo}}</includeonly>
3761 !! end
3762
3763 ###
3764 ### Message transform tests
3765 ###
3766 !! test
3767 message transform: magic variables
3768 !! options
3769 msg
3770 !! input
3771 {{SITENAME}}
3772 !! result
3773 MediaWiki
3774 !! end
3775
3776 !! test
3777 message transform: should not transform wiki markup
3778 !! options
3779 msg
3780 !! input
3781 ''test''
3782 !! result
3783 ''test''
3784 !! end
3785
3786 !! test
3787 message transform: <noinclude> in transcluded template (bug 4926)
3788 !! options
3789 msg
3790 !! input
3791 {{Includes}}
3792 !! result
3793 Foobar
3794 !! end
3795
3796 !! test
3797 message transform: <onlyinclude> in transcluded template (bug 4926)
3798 !! options
3799 msg
3800 !! input
3801 {{Includes2}}
3802 !! result
3803 Foo
3804 !! end
3805
3806 !! test
3807 {{#special:}} page name, known
3808 !! options
3809 msg
3810 !! input
3811 {{#special:Recentchanges}}
3812 !! result
3813 Special:RecentChanges
3814 !! end
3815
3816 !! test
3817 {{#special:}} page name with subpage, known
3818 !! options
3819 msg
3820 !! input
3821 {{#special:Recentchanges/param}}
3822 !! result
3823 Special:RecentChanges/param
3824 !! end
3825
3826 !! test
3827 {{#special:}} page name, unknown
3828 !! options
3829 msg
3830 !! input
3831 {{#special:foobarnonexistent}}
3832 !! result
3833 No such special page
3834 !! end
3835
3836 !! test
3837 {{#speciale:}} page name, known
3838 !! options
3839 msg
3840 !! input
3841 {{#speciale:Recentchanges}}
3842 !! result
3843 Special:RecentChanges
3844 !! end
3845
3846 !! test
3847 {{#speciale:}} page name with subpage, known
3848 !! options
3849 msg
3850 !! input
3851 {{#speciale:Recentchanges/param}}
3852 !! result
3853 Special:RecentChanges/param
3854 !! end
3855
3856 !! test
3857 {{#speciale:}} page name, unknown
3858 !! options
3859 msg
3860 !! input
3861 {{#speciale:foobarnonexistent}}
3862 !! result
3863 No_such_special_page
3864 !! end
3865
3866 ###
3867 ### Images
3868 ###
3869 !! test
3870 Simple image
3871 !! input
3872 [[Image:foobar.jpg]]
3873 !! result
3874 <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>
3875 </p>
3876 !! end
3877
3878 !! test
3879 Right-aligned image
3880 !! input
3881 [[Image:foobar.jpg|right]]
3882 !! result
3883 <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>
3884
3885 !! end
3886
3887 !! test
3888 Simple image (using File: namespace, now canonical)
3889 !! input
3890 [[File:foobar.jpg]]
3891 !! result
3892 <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>
3893 </p>
3894 !! end
3895
3896 !! test
3897 Image with caption
3898 !! input
3899 [[Image:foobar.jpg|right|Caption text]]
3900 !! result
3901 <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>
3902
3903 !! end
3904
3905 !! test
3906 Image with link parameter, wiki target
3907 !! input
3908 [[Image:foobar.jpg|link=Target page]]
3909 !! result
3910 <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>
3911 </p>
3912 !! end
3913
3914 !! test
3915 Image with link parameter, URL target
3916 !! input
3917 [[Image:foobar.jpg|link=http://example.com/]]
3918 !! result
3919 <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
3920 </p>
3921 !! end
3922
3923 !! test
3924 Image with link parameter, wgExternalLinkTarget
3925 !! input
3926 [[Image:foobar.jpg|link=http://example.com/]]
3927 !! config
3928 wgExternalLinkTarget='foobar'
3929 !! result
3930 <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>
3931 </p>
3932 !! end
3933
3934 !! test
3935 Image with link parameter, wgExternalLinkTarget, unnamed parameter
3936 !! input
3937 [[Image:foobar.jpg|link=http://example.com/|Title]]
3938 !! config
3939 wgExternalLinkTarget='foobar'
3940 !! result
3941 <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>
3942 </p>
3943 !! end
3944
3945 !! test
3946 Image with empty link parameter
3947 !! input
3948 [[Image:foobar.jpg|link=]]
3949 !! result
3950 <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
3951 </p>
3952 !! end
3953
3954 !! test
3955 Image with link parameter (wiki target) and unnamed parameter
3956 !! input
3957 [[Image:foobar.jpg|link=Target page|Title]]
3958 !! result
3959 <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>
3960 </p>
3961 !! end
3962
3963 !! test
3964 Image with link parameter (URL target) and unnamed parameter
3965 !! input
3966 [[Image:foobar.jpg|link=http://example.com/|Title]]
3967 !! result
3968 <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>
3969 </p>
3970 !! end
3971
3972 !! test
3973 Thumbnail image with link parameter
3974 !! input
3975 [[Image:foobar.jpg|thumb|link=http://example.com/|Title]]
3976 !! result
3977 <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>
3978
3979 !! end
3980
3981 !! test
3982 Image with frame and link
3983 !! input
3984 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3985 !! result
3986 <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>
3987
3988 !! end
3989
3990 !! test
3991 Image with frame and link and explicit alt
3992 !! input
3993 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
3994 !! result
3995 <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>
3996
3997 !! end
3998
3999 !! test
4000 Image with wiki markup in implicit alt
4001 !! input
4002 [[Image:Foobar.jpg|testing '''bold''' in alt]]
4003 !! result
4004 <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>
4005 </p>
4006 !! end
4007
4008 !! test
4009 Image with wiki markup in explicit alt
4010 !! input
4011 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
4012 !! result
4013 <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>
4014 </p>
4015 !! end
4016
4017 !! test
4018 Link to image page- image page normally doesn't exists, hence edit link
4019 Add test with existing image page
4020 #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
4021 !! input
4022 [[:Image:test]]
4023 !! result
4024 <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>
4025 </p>
4026 !! end
4027
4028 !! test
4029 bug 18784 Link to non-existent image page with caption should use caption as link text
4030 !! input
4031 [[:Image:test|caption]]
4032 !! result
4033 <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>
4034 </p>
4035 !! end
4036
4037 !! test
4038 Frameless image caption with a free URL
4039 !! input
4040 [[Image:foobar.jpg|http://example.com]]
4041 !! result
4042 <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>
4043 </p>
4044 !! end
4045
4046 !! test
4047 Thumbnail image caption with a free URL
4048 !! input
4049 [[Image:foobar.jpg|thumb|http://example.com]]
4050 !! result
4051 <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>
4052
4053 !! end
4054
4055 !! test
4056 Thumbnail image caption with a free URL and explicit alt
4057 !! input
4058 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
4059 !! result
4060 <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>
4061
4062 !! end
4063
4064 !! test
4065 BUG 1887: A ISBN with a thumbnail
4066 !! input
4067 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
4068 !! result
4069 <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>
4070
4071 !! end
4072
4073 !! test
4074 BUG 1887: A RFC with a thumbnail
4075 !! input
4076 [[Image:foobar.jpg|thumb|This is RFC 12354]]
4077 !! result
4078 <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>
4079
4080 !! end
4081
4082 !! test
4083 BUG 1887: A mailto link with a thumbnail
4084 !! input
4085 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
4086 !! result
4087 <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>
4088
4089 !! end
4090
4091 # Pending resolution to bug 368
4092 !! test
4093 BUG 648: Frameless image caption with a link
4094 !! input
4095 [[Image:foobar.jpg|text with a [[link]] in it]]
4096 !! result
4097 <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>
4098 </p>
4099 !! end
4100
4101 !! test
4102 BUG 648: Frameless image caption with a link (suffix)
4103 !! input
4104 [[Image:foobar.jpg|text with a [[link]]foo in it]]
4105 !! result
4106 <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>
4107 </p>
4108 !! end
4109
4110 !! test
4111 BUG 648: Frameless image caption with an interwiki link
4112 !! input
4113 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
4114 !! result
4115 <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>
4116 </p>
4117 !! end
4118
4119 !! test
4120 BUG 648: Frameless image caption with a piped interwiki link
4121 !! input
4122 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
4123 !! result
4124 <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>
4125 </p>
4126 !! end
4127
4128 !! test
4129 Escape HTML special chars in image alt text
4130 !! input
4131 [[Image:foobar.jpg|& < > "]]
4132 !! result
4133 <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>
4134 </p>
4135 !! end
4136
4137 !! test
4138 BUG 499: Alt text should have &#1234;, not &amp;1234;
4139 !! input
4140 [[Image:foobar.jpg|&#9792;]]
4141 !! result
4142 <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>
4143 </p>
4144 !! end
4145
4146 !! test
4147 Broken image caption with link
4148 !! input
4149 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
4150 !! result
4151 <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.
4152 </p>
4153 !! end
4154
4155 !! test
4156 Image caption containing another image
4157 !! input
4158 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
4159 !! result
4160 <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>
4161
4162 !! end
4163
4164 !! test
4165 Image caption containing a newline
4166 !! input
4167 [[Image:Foobar.jpg|This
4168 *is some text]]
4169 !! result
4170 <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>
4171 </p>
4172 !!end
4173
4174
4175 !! test
4176 Bug 3090: External links other than http: in image captions
4177 !! input
4178 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
4179 !! result
4180 <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>
4181
4182 !! end
4183
4184 !! article
4185 File:Barfoo.jpg
4186 !! text
4187 #REDIRECT [[File:Barfoo.jpg]]
4188 !! endarticle
4189
4190 !! test
4191 Redirected image
4192 !! input
4193 [[Image:Barfoo.jpg]]
4194 !! result
4195 <p><a href="/wiki/File:Barfoo.jpg" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
4196 </p>
4197 !! end
4198
4199 !! test
4200 Missing image with uploads disabled
4201 !! options
4202 wgEnableUploads=0
4203 !! input
4204 [[Image:Foobaz.jpg]]
4205 !! result
4206 <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
4207 </p>
4208 !! end
4209
4210
4211 ###
4212 ### Subpages
4213 ###
4214 !! article
4215 Subpage test/subpage
4216 !! text
4217 foo
4218 !! endarticle
4219
4220 !! test
4221 Subpage link
4222 !! options
4223 subpage title=[[Subpage test]]
4224 !! input
4225 [[/subpage]]
4226 !! result
4227 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
4228 </p>
4229 !! end
4230
4231 !! test
4232 Subpage noslash link
4233 !! options
4234 subpage title=[[Subpage test]]
4235 !!input
4236 [[/subpage/]]
4237 !! result
4238 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
4239 </p>
4240 !! end
4241
4242 !! test
4243 Disabled subpages
4244 !! input
4245 [[/subpage]]
4246 !! result
4247 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
4248 </p>
4249 !! end
4250
4251 !! test
4252 BUG 561: {{/Subpage}}
4253 !! options
4254 subpage title=[[Page]]
4255 !! input
4256 {{/Subpage}}
4257 !! result
4258 <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>
4259 </p>
4260 !! end
4261
4262 ###
4263 ### Categories
4264 ###
4265 !! article
4266 Category:MediaWiki User's Guide
4267 !! text
4268 blah
4269 !! endarticle
4270
4271 !! test
4272 Link to category
4273 !! input
4274 [[:Category:MediaWiki User's Guide]]
4275 !! result
4276 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
4277 </p>
4278 !! end
4279
4280 !! test
4281 Simple category
4282 !! options
4283 cat
4284 !! input
4285 [[Category:MediaWiki User's Guide]]
4286 !! result
4287 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
4288 !! end
4289
4290 !! test
4291 PAGESINCATEGORY invalid title fatal (r33546 fix)
4292 !! input
4293 {{PAGESINCATEGORY:<bogus>}}
4294 !! result
4295 <p>0
4296 </p>
4297 !! end
4298
4299 ###
4300 ### Inter-language links
4301 ###
4302 !! test
4303 Inter-language links
4304 !! options
4305 ill
4306 !! input
4307 [[es:Alimento]]
4308 [[fr:Nourriture]]
4309 [[zh:&#39135;&#21697;]]
4310 !! result
4311 es:Alimento fr:Nourriture zh:食品
4312 !! end
4313
4314 ###
4315 ### Sections
4316 ###
4317 !! test
4318 Basic section headings
4319 !! input
4320 == Headline 1 ==
4321 Some text
4322
4323 ==Headline 2==
4324 More
4325 ===Smaller headline===
4326 Blah blah
4327 !! result
4328 <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>
4329 <p>Some text
4330 </p>
4331 <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>
4332 <p>More
4333 </p>
4334 <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>
4335 <p>Blah blah
4336 </p>
4337 !! end
4338
4339 !! test
4340 Section headings with TOC
4341 !! input
4342 == Headline 1 ==
4343 === Subheadline 1 ===
4344 ===== Skipping a level =====
4345 ====== Skipping a level ======
4346
4347 == Headline 2 ==
4348 Some text
4349 ===Another headline===
4350 !! result
4351 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4352 <ul>
4353 <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
4354 <ul>
4355 <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
4356 <ul>
4357 <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>
4358 <ul>
4359 <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>
4360 </ul>
4361 </li>
4362 </ul>
4363 </li>
4364 </ul>
4365 </li>
4366 <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
4367 <ul>
4368 <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
4369 </ul>
4370 </li>
4371 </ul>
4372 </td></tr></table>
4373 <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>
4374 <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>
4375 <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>
4376 <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>
4377 <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>
4378 <p>Some text
4379 </p>
4380 <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>
4381
4382 !! end
4383
4384 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
4385 !! test
4386 Handling of sections up to level 6 and beyond
4387 !! input
4388 = Level 1 Heading=
4389 == Level 2 Heading==
4390 === Level 3 Heading===
4391 ==== Level 4 Heading====
4392 ===== Level 5 Heading=====
4393 ====== Level 6 Heading======
4394 ======= Level 7 Heading=======
4395 ======== Level 8 Heading========
4396 ========= Level 9 Heading=========
4397 ========== Level 10 Heading==========
4398 !! result
4399 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4400 <ul>
4401 <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
4402 <ul>
4403 <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>
4404 <ul>
4405 <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>
4406 <ul>
4407 <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>
4408 <ul>
4409 <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>
4410 <ul>
4411 <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>
4412 <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>
4413 <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>
4414 <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>
4415 <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>
4416 </ul>
4417 </li>
4418 </ul>
4419 </li>
4420 </ul>
4421 </li>
4422 </ul>
4423 </li>
4424 </ul>
4425 </li>
4426 </ul>
4427 </td></tr></table>
4428 <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>
4429 <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>
4430 <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>
4431 <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>
4432 <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>
4433 <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>
4434 <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>
4435 <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>
4436 <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>
4437 <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>
4438
4439 !! end
4440
4441 !! test
4442 TOC regression (bug 9764)
4443 !! input
4444 == title 1 ==
4445 === title 1.1 ===
4446 ==== title 1.1.1 ====
4447 === title 1.2 ===
4448 == title 2 ==
4449 === title 2.1 ===
4450 !! result
4451 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4452 <ul>
4453 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4454 <ul>
4455 <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>
4456 <ul>
4457 <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>
4458 </ul>
4459 </li>
4460 <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>
4461 </ul>
4462 </li>
4463 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
4464 <ul>
4465 <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>
4466 </ul>
4467 </li>
4468 </ul>
4469 </td></tr></table>
4470 <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>
4471 <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>
4472 <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>
4473 <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>
4474 <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>
4475 <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>
4476
4477 !! end
4478
4479 !! test
4480 TOC with wgMaxTocLevel=3 (bug 6204)
4481 !! options
4482 wgMaxTocLevel=3
4483 !! input
4484 == title 1 ==
4485 === title 1.1 ===
4486 ==== title 1.1.1 ====
4487 === title 1.2 ===
4488 == title 2 ==
4489 === title 2.1 ===
4490 !! result
4491 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4492 <ul>
4493 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4494 <ul>
4495 <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>
4496 <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>
4497 </ul>
4498 </li>
4499 <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
4500 <ul>
4501 <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>
4502 </ul>
4503 </li>
4504 </ul>
4505 </td></tr></table>
4506 <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>
4507 <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>
4508 <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>
4509 <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>
4510 <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>
4511 <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>
4512
4513 !! end
4514
4515 !! test
4516 TOC with wgMaxTocLevel=3 and two level four headings (bug 6204)
4517 !! options
4518 wgMaxTocLevel=3
4519 !! input
4520 ==Section 1==
4521 ===Section 1.1===
4522 ====Section 1.1.1====
4523 ====Section 1.1.1.1====
4524 ==Section 2==
4525 !! result
4526 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4527 <ul>
4528 <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
4529 <ul>
4530 <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>
4531 </ul>
4532 </li>
4533 <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
4534 </ul>
4535 </td></tr></table>
4536 <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>
4537 <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>
4538 <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>
4539 <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>
4540 <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>
4541
4542 !! end
4543
4544
4545 !! test
4546 Resolving duplicate section names
4547 !! input
4548 == Foo bar ==
4549 == Foo bar ==
4550 !! result
4551 <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>
4552 <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>
4553
4554 !! end
4555
4556 !! test
4557 Resolving duplicate section names with differing case (bug 10721)
4558 !! input
4559 == Foo bar ==
4560 == Foo Bar ==
4561 !! result
4562 <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>
4563 <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>
4564
4565 !! end
4566
4567 !! article
4568 Template:sections
4569 !! text
4570 ===Section 1===
4571 ==Section 2==
4572 !! endarticle
4573
4574 !! test
4575 Template with sections, __NOTOC__
4576 !! input
4577 __NOTOC__
4578 ==Section 0==
4579 {{sections}}
4580 ==Section 4==
4581 !! result
4582 <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>
4583 <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>
4584 <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>
4585 <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>
4586
4587 !! end
4588
4589 !! test
4590 __NOEDITSECTION__ keyword
4591 !! input
4592 __NOEDITSECTION__
4593 ==Section 1==
4594 ==Section 2==
4595 !! result
4596 <h2> <span class="mw-headline" id="Section_1">Section 1</span></h2>
4597 <h2> <span class="mw-headline" id="Section_2">Section 2</span></h2>
4598
4599 !! end
4600
4601 !! test
4602 Link inside a section heading
4603 !! input
4604 ==Section with a [[Main Page|link]] in it==
4605 !! result
4606 <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>
4607
4608 !! end
4609
4610 !! test
4611 TOC regression (bug 12077)
4612 !! input
4613 __TOC__
4614 == title 1 ==
4615 === title 1.1 ===
4616 == title 2 ==
4617 !! result
4618 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4619 <ul>
4620 <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
4621 <ul>
4622 <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>
4623 </ul>
4624 </li>
4625 <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
4626 </ul>
4627 </td></tr></table>
4628 <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>
4629 <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>
4630 <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>
4631
4632 !! end
4633
4634 !! test
4635 BUG 1219 URL next to image (good)
4636 !! input
4637 http://example.com [[Image:foobar.jpg]]
4638 !! result
4639 <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>
4640 </p>
4641 !!end
4642
4643 !! test
4644 Short headings with trailing space should match behaviour of Parser::doHeadings (bug 19910)
4645 !! input
4646 ===
4647 The line above must have a trailing space!
4648 === <!--
4649 --> <!-- -->
4650 But just in case it doesn't...
4651 !! result
4652 <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>
4653 <p>The line above must have a trailing space!
4654 </p>
4655 <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>
4656 <p>But just in case it doesn't...
4657 </p>
4658 !! end
4659
4660 !! test
4661 Header with special characters (bug 25462)
4662 !! input
4663 The tooltips shall not show entities to the user (ie. be double escaped)
4664
4665 == text > text ==
4666 section 1
4667
4668 == text < text ==
4669 section 2
4670
4671 == text & text ==
4672 section 3
4673
4674 == text ' text ==
4675 section 4
4676
4677 == text " text ==
4678 section 5
4679 !! result
4680 <p>The tooltips shall not show entities to the user (ie. be double escaped)
4681 </p>
4682 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4683 <ul>
4684 <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>
4685 <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>
4686 <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>
4687 <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
4688 <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
4689 </ul>
4690 </td></tr></table>
4691 <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>
4692 <p>section 1
4693 </p>
4694 <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>
4695 <p>section 2
4696 </p>
4697 <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>
4698 <p>section 3
4699 </p>
4700 <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>
4701 <p>section 4
4702 </p>
4703 <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>
4704 <p>section 5
4705 </p>
4706 !! end
4707
4708 !! test
4709 BUG 1219 URL next to image (broken)
4710 !! input
4711 http://example.com[[Image:foobar.jpg]]
4712 !! result
4713 <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>
4714 </p>
4715 !!end
4716
4717 !! test
4718 Bug 1186 news: in the middle of text
4719 !! input
4720 http://en.wikinews.org/wiki/Wikinews:Workplace
4721 !! result
4722 <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
4723 </p>
4724 !!end
4725
4726
4727 !! test
4728 Namespaced link must have a title
4729 !! input
4730 [[Project:]]
4731 !! result
4732 <p>[[Project:]]
4733 </p>
4734 !!end
4735
4736 !! test
4737 Namespaced link must have a title (bad fragment version)
4738 !! input
4739 [[Project:#fragment]]
4740 !! result
4741 <p>[[Project:#fragment]]
4742 </p>
4743 !!end
4744
4745
4746 !! test
4747 div with no attributes
4748 !! input
4749 <div>HTML rocks</div>
4750 !! result
4751 <div>HTML rocks</div>
4752
4753 !! end
4754
4755 !! test
4756 div with double-quoted attribute
4757 !! input
4758 <div id="rock">HTML rocks</div>
4759 !! result
4760 <div id="rock">HTML rocks</div>
4761
4762 !! end
4763
4764 !! test
4765 div with single-quoted attribute
4766 !! input
4767 <div id='rock'>HTML rocks</div>
4768 !! result
4769 <div id="rock">HTML rocks</div>
4770
4771 !! end
4772
4773 !! test
4774 div with unquoted attribute
4775 !! input
4776 <div id=rock>HTML rocks</div>
4777 !! result
4778 <div id="rock">HTML rocks</div>
4779
4780 !! end
4781
4782 !! test
4783 div with illegal double attributes
4784 !! input
4785 <div id="a" id="b">HTML rocks</div>
4786 !! result
4787 <div id="b">HTML rocks</div>
4788
4789 !!end
4790
4791 !! test
4792 HTML multiple attributes correction
4793 !! input
4794 <p class="error" class="awesome">Awesome!</p>
4795 !! result
4796 <p class="awesome">Awesome!</p>
4797
4798 !!end
4799
4800 !! test
4801 Table multiple attributes correction
4802 !! input
4803 {|
4804 !+ class="error" class="awesome"| status
4805 |}
4806 !! result
4807 <table>
4808 <tr>
4809 <th class="awesome"> status
4810 </th></tr></table>
4811
4812 !!end
4813
4814 !! test
4815 DIV IN UPPERCASE
4816 !! input
4817 <DIV ID="x">HTML ROCKS</DIV>
4818 !! result
4819 <div id="x">HTML ROCKS</div>
4820
4821 !!end
4822
4823
4824 !! test
4825 text with amp in the middle of nowhere
4826 !! input
4827 Remember AT&T?
4828 !!result
4829 <p>Remember AT&amp;T?
4830 </p>
4831 !! end
4832
4833 !! test
4834 text with character entity: eacute
4835 !! input
4836 I always thought &eacute; was a cute letter.
4837 !! result
4838 <p>I always thought &#233; was a cute letter.
4839 </p>
4840 !! end
4841
4842 !! test
4843 text with undefined character entity: xacute
4844 !! input
4845 I always thought &xacute; was a cute letter.
4846 !! result
4847 <p>I always thought &amp;xacute; was a cute letter.
4848 </p>
4849 !! end
4850
4851
4852 ###
4853 ### Media links
4854 ###
4855
4856 !! test
4857 Media link
4858 !! input
4859 [[Media:Foobar.jpg]]
4860 !! result
4861 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
4862 </p>
4863 !! end
4864
4865 !! test
4866 Media link with text
4867 !! input
4868 [[Media:Foobar.jpg|A neat file to look at]]
4869 !! result
4870 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
4871 </p>
4872 !! end
4873
4874 # FIXME: this is still bad HTML tag nesting
4875 !! test
4876 Media link with nasty text
4877 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
4878 !! input
4879 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
4880 !! result
4881 <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>
4882
4883 !! end
4884
4885 !! test
4886 Media link to nonexistent file (bug 1702)
4887 !! input
4888 [[Media:No such.jpg]]
4889 !! result
4890 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
4891 </p>
4892 !! end
4893
4894 !! test
4895 Image link to nonexistent file (bug 1850 - good)
4896 !! input
4897 [[Image:No such.jpg]]
4898 !! result
4899 <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>
4900 </p>
4901 !! end
4902
4903 !! test
4904 :Image link to nonexistent file (bug 1850 - bad)
4905 !! input
4906 [[:Image:No such.jpg]]
4907 !! result
4908 <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>
4909 </p>
4910 !! end
4911
4912
4913
4914 !! test
4915 Character reference normalization in link text (bug 1938)
4916 !! input
4917 [[Main Page|this&that]]
4918 !! result
4919 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
4920 </p>
4921 !!end
4922
4923 !! article
4924 אַ
4925 !! text
4926 Test for unicode normalization
4927
4928 The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
4929 !! endarticle
4930
4931 !! test
4932 (bug 19451) Links should refer to the normalized form.
4933 !! input
4934 [[&#xFB2E;]]
4935 [[&#x5d0;&#x5b7;]]
4936 [[&#x5d0;ַ]]
4937 [[א&#x5b7;]]
4938 [[אַ]]
4939 !! result
4940 <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
4941 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
4942 <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
4943 <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
4944 <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
4945 </p>
4946 !! end
4947
4948 !! test
4949 Empty attribute crash test (bug 2067)
4950 !! input
4951 <font color="">foo</font>
4952 !! result
4953 <p><font color="">foo</font>
4954 </p>
4955 !! end
4956
4957 !! test
4958 Empty attribute crash test single-quotes (bug 2067)
4959 !! input
4960 <font color=''>foo</font>
4961 !! result
4962 <p><font color="">foo</font>
4963 </p>
4964 !! end
4965
4966 !! test
4967 Attribute test: equals, then nothing
4968 !! input
4969 <font color=>foo</font>
4970 !! result
4971 <p><font>foo</font>
4972 </p>
4973 !! end
4974
4975 !! test
4976 Attribute test: unquoted value
4977 !! input
4978 <font color=x>foo</font>
4979 !! result
4980 <p><font color="x">foo</font>
4981 </p>
4982 !! end
4983
4984 !! test
4985 Attribute test: unquoted but illegal value (hash)
4986 !! input
4987 <font color=#x>foo</font>
4988 !! result
4989 <p><font color="#x">foo</font>
4990 </p>
4991 !! end
4992
4993 !! test
4994 Attribute test: no value
4995 !! input
4996 <font color>foo</font>
4997 !! result
4998 <p><font color="color">foo</font>
4999 </p>
5000 !! end
5001
5002 !! test
5003 Bug 2095: link with three closing brackets
5004 !! input
5005 [[Main Page]]]
5006 !! result
5007 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
5008 </p>
5009 !! end
5010
5011 !! test
5012 Bug 2095: link with pipe and three closing brackets
5013 !! input
5014 [[Main Page|link]]]
5015 !! result
5016 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
5017 </p>
5018 !! end
5019
5020 !! test
5021 Bug 2095: link with pipe and three closing brackets, version 2
5022 !! input
5023 [[Main Page|[http://example.com/]]]
5024 !! result
5025 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
5026 </p>
5027 !! end
5028
5029
5030 ###
5031 ### Safety
5032 ###
5033
5034 !! article
5035 Template:Dangerous attribute
5036 !! text
5037 " onmouseover="alert(document.cookie)
5038 !! endarticle
5039
5040 !! article
5041 Template:Dangerous style attribute
5042 !! text
5043 border-size: expression(alert(document.cookie))
5044 !! endarticle
5045
5046 !! article
5047 Template:Div style
5048 !! text
5049 <div style="float: right; {{{1}}}">Magic div</div>
5050 !! endarticle
5051
5052 !! test
5053 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
5054 !! input
5055 <div title="{{test}}"></div>
5056 !! result
5057 <div title="This is a test template"></div>
5058
5059 !! end
5060
5061 !! test
5062 Bug 2304: HTML attribute safety (dangerous template; 2309)
5063 !! input
5064 <div title="{{dangerous attribute}}"></div>
5065 !! result
5066 <div title=""></div>
5067
5068 !! end
5069
5070 !! test
5071 Bug 2304: HTML attribute safety (dangerous style template; 2309)
5072 !! input
5073 <div style="{{dangerous style attribute}}"></div>
5074 !! result
5075 <div style="/* insecure input */"></div>
5076
5077 !! end
5078
5079 !! test
5080 Bug 2304: HTML attribute safety (safe parameter; 2309)
5081 !! input
5082 {{div style|width: 200px}}
5083 !! result
5084 <div style="float: right; width: 200px">Magic div</div>
5085
5086 !! end
5087
5088 !! test
5089 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
5090 !! input
5091 {{div style|width: expression(alert(document.cookie))}}
5092 !! result
5093 <div style="/* insecure input */">Magic div</div>
5094
5095 !! end
5096
5097 !! test
5098 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
5099 !! input
5100 {{div style|"><script>alert(document.cookie)</script>}}
5101 !! result
5102 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5103
5104 !! end
5105
5106 !! test
5107 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 2309)
5108 !! input
5109 {{div style|" ><script>alert(document.cookie)</script>}}
5110 !! result
5111 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
5112
5113 !! end
5114
5115 !! test
5116 Bug 2304: HTML attribute safety (link)
5117 !! input
5118 <div title="[[Main Page]]"></div>
5119 !! result
5120 <div title="&#91;&#91;Main Page]]"></div>
5121
5122 !! end
5123
5124 !! test
5125 Bug 2304: HTML attribute safety (italics)
5126 !! input
5127 <div title="''foobar''"></div>
5128 !! result
5129 <div title="&#39;&#39;foobar&#39;&#39;"></div>
5130
5131 !! end
5132
5133 !! test
5134 Bug 2304: HTML attribute safety (bold)
5135 !! input
5136 <div title="'''foobar'''"></div>
5137 !! result
5138 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
5139
5140 !! end
5141
5142
5143 !! test
5144 Bug 2304: HTML attribute safety (ISBN)
5145 !! input
5146 <div title="ISBN 1234567890"></div>
5147 !! result
5148 <div title="&#73;SBN 1234567890"></div>
5149
5150 !! end
5151
5152 !! test
5153 Bug 2304: HTML attribute safety (RFC)
5154 !! input
5155 <div title="RFC 1234"></div>
5156 !! result
5157 <div title="&#82;FC 1234"></div>
5158
5159 !! end
5160
5161 !! test
5162 Bug 2304: HTML attribute safety (PMID)
5163 !! input
5164 <div title="PMID 1234567890"></div>
5165 !! result
5166 <div title="&#80;MID 1234567890"></div>
5167
5168 !! end
5169
5170 !! test
5171 Bug 2304: HTML attribute safety (web link)
5172 !! input
5173 <div title="http://example.com/"></div>
5174 !! result
5175 <div title="http&#58;//example.com/"></div>
5176
5177 !! end
5178
5179 !! test
5180 Bug 2304: HTML attribute safety (named web link)
5181 !! input
5182 <div title="[http://example.com/ link]"></div>
5183 !! result
5184 <div title="&#91;http&#58;//example.com/ link]"></div>
5185
5186 !! end
5187
5188 !! test
5189 Bug 3244: HTML attribute safety (extension; safe)
5190 !! input
5191 <div style="<nowiki>background:blue</nowiki>"></div>
5192 !! result
5193 <div style="background:blue"></div>
5194
5195 !! end
5196
5197 !! test
5198 Bug 3244: HTML attribute safety (extension; unsafe)
5199 !! input
5200 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
5201 !! result
5202 <div style="/* insecure input */"></div>
5203
5204 !! end
5205
5206 # More MSIE fun discovered by Tom Gilder
5207
5208 !! test
5209 MSIE CSS safety test: spurious slash
5210 !! input
5211 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
5212 !! result
5213 <div style="/* insecure input */">evil</div>
5214
5215 !! end
5216
5217 !! test
5218 MSIE CSS safety test: hex code
5219 !! input
5220 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
5221 !! result
5222 <div style="/* insecure input */">evil</div>
5223
5224 !! end
5225
5226 !! test
5227 MSIE CSS safety test: comment in url
5228 !! input
5229 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
5230 !! result
5231 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
5232
5233 !! end
5234
5235 !! test
5236 MSIE CSS safety test: comment in expression
5237 !! input
5238 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
5239 !! result
5240 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
5241
5242 !! end
5243
5244
5245 !! test
5246 Table attribute legitimate extension
5247 !! input
5248 {|
5249 !+ style="<nowiki>color:blue</nowiki>"| status
5250 |}
5251 !! result
5252 <table>
5253 <tr>
5254 <th style="color:blue"> status
5255 </th></tr></table>
5256
5257 !!end
5258
5259 !! test
5260 Table attribute safety
5261 !! input
5262 {|
5263 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
5264 |}
5265 !! result
5266 <table>
5267 <tr>
5268 <th style="/* insecure input */"> status
5269 </th></tr></table>
5270
5271 !! end
5272
5273 !! test
5274 CSS line continuation 1
5275 !! input
5276 <div style="background-image: u\&#10;rl(test.jpg);"></div>
5277 !! result
5278 <div style="/* insecure input */"></div>
5279
5280 !! end
5281
5282 !! test
5283 CSS line continuation 2
5284 !! input
5285 <div style="background-image: u\&#13;rl(test.jpg); "></div>
5286 !! result
5287 <div style="/* insecure input */"></div>
5288
5289 !! end
5290
5291 !! article
5292 Template:Identity
5293 !! text
5294 {{{1}}}
5295 !! endarticle
5296
5297 !! test
5298 Expansion of multi-line templates in attribute values (bug 6255)
5299 !! input
5300 <div style="background: {{identity|#00FF00}}">-</div>
5301 !! result
5302 <div style="background: #00FF00">-</div>
5303
5304 !! end
5305
5306
5307 !! test
5308 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
5309 !! input
5310 <div style="background:
5311 #00FF00">-</div>
5312 !! result
5313 <div style="background: #00FF00">-</div>
5314
5315 !! end
5316
5317 !! test
5318 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
5319 !! input
5320 <div style="background: &#10;#00FF00">-</div>
5321 !! result
5322 <div style="background: &#10;#00FF00">-</div>
5323
5324 !! end
5325
5326 ###
5327 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
5328 ###
5329 !! test
5330 Parser hook: empty input
5331 !! input
5332 <tag></tag>
5333 !! result
5334 <pre>
5335 string(0) ""
5336 array(0) {
5337 }
5338 </pre>
5339
5340 !! end
5341
5342 !! test
5343 Parser hook: empty input using terminated empty elements
5344 !! input
5345 <tag/>
5346 !! result
5347 <pre>
5348 NULL
5349 array(0) {
5350 }
5351 </pre>
5352
5353 !! end
5354
5355 !! test
5356 Parser hook: empty input using terminated empty elements (space before)
5357 !! input
5358 <tag />
5359 !! result
5360 <pre>
5361 NULL
5362 array(0) {
5363 }
5364 </pre>
5365
5366 !! end
5367
5368 !! test
5369 Parser hook: basic input
5370 !! input
5371 <tag>input</tag>
5372 !! result
5373 <pre>
5374 string(5) "input"
5375 array(0) {
5376 }
5377 </pre>
5378
5379 !! end
5380
5381
5382 !! test
5383 Parser hook: case insensitive
5384 !! input
5385 <TAG>input</TAG>
5386 !! result
5387 <pre>
5388 string(5) "input"
5389 array(0) {
5390 }
5391 </pre>
5392
5393 !! end
5394
5395
5396 !! test
5397 Parser hook: case insensitive, redux
5398 !! input
5399 <TaG>input</TAg>
5400 !! result
5401 <pre>
5402 string(5) "input"
5403 array(0) {
5404 }
5405 </pre>
5406
5407 !! end
5408
5409 !! test
5410 Parser hook: nested tags
5411 !! options
5412 noxml
5413 !! input
5414 <tag><tag></tag></tag>
5415 !! result
5416 <pre>
5417 string(5) "<tag>"
5418 array(0) {
5419 }
5420 </pre>&lt;/tag&gt;
5421
5422 !! end
5423
5424 !! test
5425 Parser hook: basic arguments
5426 !! input
5427 <tag width=200 height = "100" depth = '50' square></tag>
5428 !! result
5429 <pre>
5430 string(0) ""
5431 array(4) {
5432 ["width"]=>
5433 string(3) "200"
5434 ["height"]=>
5435 string(3) "100"
5436 ["depth"]=>
5437 string(2) "50"
5438 ["square"]=>
5439 string(6) "square"
5440 }
5441 </pre>
5442
5443 !! end
5444
5445 !! test
5446 Parser hook: argument containing a forward slash (bug 5344)
5447 !! input
5448 <tag filename='/tmp/bla'></tag>
5449 !! result
5450 <pre>
5451 string(0) ""
5452 array(1) {
5453 ["filename"]=>
5454 string(8) "/tmp/bla"
5455 }
5456 </pre>
5457
5458 !! end
5459
5460 !! test
5461 Parser hook: empty input using terminated empty elements (bug 2374)
5462 !! input
5463 <tag foo=bar/>text
5464 !! result
5465 <pre>
5466 NULL
5467 array(1) {
5468 ["foo"]=>
5469 string(3) "bar"
5470 }
5471 </pre>text
5472
5473 !! end
5474
5475 # </tag> should be output literally since there is no matching tag that begins it
5476 !! test
5477 Parser hook: basic arguments using terminated empty elements (bug 2374)
5478 !! input
5479 <tag width=200 height = "100" depth = '50' square/>
5480 other stuff
5481 </tag>
5482 !! result
5483 <pre>
5484 NULL
5485 array(4) {
5486 ["width"]=>
5487 string(3) "200"
5488 ["height"]=>
5489 string(3) "100"
5490 ["depth"]=>
5491 string(2) "50"
5492 ["square"]=>
5493 string(6) "square"
5494 }
5495 </pre>
5496 <p>other stuff
5497 &lt;/tag&gt;
5498 </p>
5499 !! end
5500
5501 ###
5502 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
5503 ###
5504
5505 !! test
5506 Parser hook: static parser hook not inside a comment
5507 !! input
5508 <statictag>hello, world</statictag>
5509 <statictag action=flush/>
5510 !! result
5511 <p>hello, world
5512 </p>
5513 !! end
5514
5515
5516 !! test
5517 Parser hook: static parser hook inside a comment
5518 !! input
5519 <!-- <statictag>hello, world</statictag> -->
5520 <statictag action=flush/>
5521 !! result
5522 <p><br />
5523 </p>
5524 !! end
5525
5526 # Nested template calls; this case was broken by Parser.php rev 1.506,
5527 # since reverted.
5528
5529 !! article
5530 Template:One-parameter
5531 !! text
5532 (My parameter is: {{{1}}})
5533 !! endarticle
5534
5535 !! article
5536 Template:Map-one-parameter
5537 !! text
5538 {{{{{1}}}|{{{2}}}}}
5539 !! endarticle
5540
5541 !! test
5542 Nested template calls
5543 !! input
5544 {{Map-one-parameter|One-parameter|param}}
5545 !! result
5546 <p>(My parameter is: param)
5547 </p>
5548 !! end
5549
5550
5551 ###
5552 ### Sanitizer
5553 ###
5554 !! test
5555 Sanitizer: Closing of open tags
5556 !! input
5557 <s></s><table></table>
5558 !! result
5559 <s></s><table></table>
5560
5561 !! end
5562
5563 !! test
5564 Sanitizer: Closing of open but not closed tags
5565 !! input
5566 <s>foo
5567 !! result
5568 <p><s>foo</s>
5569 </p>
5570 !! end
5571
5572 !! test
5573 Sanitizer: Closing of closed but not open tags
5574 !! input
5575 </s>
5576 !! result
5577 <p>&lt;/s&gt;
5578 </p>
5579 !! end
5580
5581 !! test
5582 Sanitizer: Closing of closed but not open table tags
5583 !! input
5584 Table not started</td></tr></table>
5585 !! result
5586 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
5587 </p>
5588 !! end
5589
5590 !! test
5591 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
5592 !! input
5593 <span id="æ: v">byte</span>[[#æ: v|backlink]]
5594 !! result
5595 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
5596 </p>
5597 !! end
5598
5599 !! test
5600 Sanitizer: Validating the contents of the id attribute (bug 4515)
5601 !! options
5602 disabled
5603 !! input
5604 <br id=9 />
5605 !! result
5606 Something, but definitely not <br id="9" />...
5607 !! end
5608
5609 !! test
5610 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
5611 !! options
5612 disabled
5613 !! input
5614 <br id="foo" /><br id="foo" />
5615 !! result
5616 Something need to be done. foo-2 ?
5617 !! end
5618
5619 !! test
5620 Language converter: output gets cut off unexpectedly (bug 5757)
5621 !! options
5622 language=zh
5623 !! input
5624 this bit is safe: }-
5625
5626 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
5627
5628 then we get cut off here: }-
5629
5630 all additional text is vanished
5631 !! result
5632 <p>this bit is safe: }-
5633 </p><p>but if we add a conversion instance: xxx
5634 </p><p>then we get cut off here: }-
5635 </p><p>all additional text is vanished
5636 </p>
5637 !! end
5638
5639 !! test
5640 Self closed html pairs (bug 5487)
5641 !! options
5642 !! input
5643 <center><font id="bug" />Centered text</center>
5644 <div><font id="bug2" />In div text</div>
5645 !! result
5646 <center>&lt;font id="bug" /&gt;Centered text</center>
5647 <div>&lt;font id="bug2" /&gt;In div text</div>
5648
5649 !! end
5650
5651 #
5652 #
5653 #
5654
5655 !! test
5656 Punctuation: nbsp before exclamation
5657 !! input
5658 C'est grave !
5659 !! result
5660 <p>C'est grave&#160;!
5661 </p>
5662 !! end
5663
5664 !! test
5665 Punctuation: CSS !important (bug 11874)
5666 !! input
5667 <div style="width:50% !important">important</div>
5668 !! result
5669 <div style="width:50% !important">important</div>
5670
5671 !!end
5672
5673 !! test
5674 Punctuation: CSS ! important (bug 11874; with space after)
5675 !! input
5676 <div style="width:50% ! important">important</div>
5677 !! result
5678 <div style="width:50% ! important">important</div>
5679
5680 !!end
5681
5682
5683 !! test
5684 HTML bullet list, closed tags (bug 5497)
5685 !! input
5686 <ul>
5687 <li>One</li>
5688 <li>Two</li>
5689 </ul>
5690 !! result
5691 <ul>
5692 <li>One</li>
5693 <li>Two</li>
5694 </ul>
5695
5696 !! end
5697
5698 !! test
5699 HTML bullet list, unclosed tags (bug 5497)
5700 !! options
5701 disabled
5702 !! input
5703 <ul>
5704 <li>One
5705 <li>Two
5706 </ul>
5707 !! result
5708 <ul>
5709 <li>One
5710 </li><li>Two
5711 </li></ul>
5712
5713 !! end
5714
5715 !! test
5716 HTML ordered list, closed tags (bug 5497)
5717 !! input
5718 <ol>
5719 <li>One</li>
5720 <li>Two</li>
5721 </ol>
5722 !! result
5723 <ol>
5724 <li>One</li>
5725 <li>Two</li>
5726 </ol>
5727
5728 !! end
5729
5730 !! test
5731 HTML ordered list, unclosed tags (bug 5497)
5732 !! options
5733 disabled
5734 !! input
5735 <ol>
5736 <li>One
5737 <li>Two
5738 </ol>
5739 !! result
5740 <ol>
5741 <li>One
5742 </li><li>Two
5743 </li></ol>
5744
5745 !! end
5746
5747 !! test
5748 HTML nested bullet list, closed tags (bug 5497)
5749 !! input
5750 <ul>
5751 <li>One</li>
5752 <li>Two:
5753 <ul>
5754 <li>Sub-one</li>
5755 <li>Sub-two</li>
5756 </ul>
5757 </li>
5758 </ul>
5759 !! result
5760 <ul>
5761 <li>One</li>
5762 <li>Two:
5763 <ul>
5764 <li>Sub-one</li>
5765 <li>Sub-two</li>
5766 </ul>
5767 </li>
5768 </ul>
5769
5770 !! end
5771
5772 !! test
5773 HTML nested bullet list, open tags (bug 5497)
5774 !! options
5775 disabled
5776 !! input
5777 <ul>
5778 <li>One
5779 <li>Two:
5780 <ul>
5781 <li>Sub-one
5782 <li>Sub-two
5783 </ul>
5784 </ul>
5785 !! result
5786 <ul>
5787 <li>One
5788 </li><li>Two:
5789 <ul>
5790 <li>Sub-one
5791 </li><li>Sub-two
5792 </li></ul>
5793 </li></ul>
5794
5795 !! end
5796
5797 !! test
5798 HTML nested ordered list, closed tags (bug 5497)
5799 !! input
5800 <ol>
5801 <li>One</li>
5802 <li>Two:
5803 <ol>
5804 <li>Sub-one</li>
5805 <li>Sub-two</li>
5806 </ol>
5807 </li>
5808 </ol>
5809 !! result
5810 <ol>
5811 <li>One</li>
5812 <li>Two:
5813 <ol>
5814 <li>Sub-one</li>
5815 <li>Sub-two</li>
5816 </ol>
5817 </li>
5818 </ol>
5819
5820 !! end
5821
5822 !! test
5823 HTML nested ordered list, open tags (bug 5497)
5824 !! options
5825 disabled
5826 !! input
5827 <ol>
5828 <li>One
5829 <li>Two:
5830 <ol>
5831 <li>Sub-one
5832 <li>Sub-two
5833 </ol>
5834 </ol>
5835 !! result
5836 <ol>
5837 <li>One
5838 </li><li>Two:
5839 <ol>
5840 <li>Sub-one
5841 </li><li>Sub-two
5842 </li></ol>
5843 </li></ol>
5844
5845 !! end
5846
5847 !! test
5848 HTML ordered list item with parameters oddity
5849 !! input
5850 <ol><li id="fragment">One</li></ol>
5851 !! result
5852 <ol><li id="fragment">One</li></ol>
5853
5854 !! end
5855
5856 !!test
5857 bug 5918: autonumbering
5858 !! input
5859 [http://first/] [http://second] [ftp://ftp]
5860
5861 ftp://inlineftp
5862
5863 [mailto:enclosed@mail.tld With target]
5864
5865 [mailto:enclosed@mail.tld]
5866
5867 mailto:inline@mail.tld
5868 !! result
5869 <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>
5870 </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
5871 </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
5872 </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
5873 </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
5874 </p>
5875 !! end
5876
5877
5878 #
5879 # Security and HTML correctness
5880 # From Nick Jenkins' fuzz testing
5881 #
5882
5883 !! test
5884 Fuzz testing: Parser13
5885 !! input
5886 {|
5887 | http://a|
5888 !! result
5889 <table>
5890 <tr>
5891 <td>
5892 </td>
5893 </tr>
5894 </table>
5895
5896 !! end
5897
5898 !! test
5899 Fuzz testing: Parser14
5900 !! input
5901 == onmouseover= ==
5902 http://__TOC__
5903 !! result
5904 <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>
5905 http://<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
5906 <ul>
5907 <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
5908 </ul>
5909 </td></tr></table>
5910
5911 !! end
5912
5913 !! test
5914 Fuzz testing: Parser14-table
5915 !! input
5916 ==a==
5917 {| STYLE=__TOC__
5918 !! result
5919 <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>
5920 <table style="&#95;_TOC&#95;_">
5921 <tr><td></td></tr>
5922 </table>
5923
5924 !! end
5925
5926 # Known to produce bogus xml (extra </td>)
5927 !! test
5928 Fuzz testing: Parser16
5929 !! options
5930 noxml
5931 !! input
5932 {|
5933 !https://||||||
5934 !! result
5935 <table>
5936 <tr>
5937 <th>https://</th>
5938 <th></th>
5939 <th></th>
5940 <th>
5941 </td>
5942 </tr>
5943 </table>
5944
5945 !! end
5946
5947 !! test
5948 Fuzz testing: Parser21
5949 !! input
5950 {|
5951 ! irc://{{ftp://a" onmouseover="alert('hello world');"
5952 |
5953 !! result
5954 <table>
5955 <tr>
5956 <th> <a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
5957 </th>
5958 <td>
5959 </td>
5960 </tr>
5961 </table>
5962
5963 !! end
5964
5965 !! test
5966 Fuzz testing: Parser22
5967 !! input
5968 http://===r:::https://b
5969
5970 {|
5971 !!result
5972 <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
5973 </p>
5974 <table>
5975 <tr><td></td></tr>
5976 </table>
5977
5978 !! end
5979
5980 # Known to produce bad XML for now
5981 !! test
5982 Fuzz testing: Parser24
5983 !! options
5984 noxml
5985 !! input
5986 {|
5987 {{{|
5988 <u CLASS=
5989 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
5990 <br style="onmouseover='alert(document.cookie);' " />
5991
5992 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
5993 |
5994 !! result
5995 <table>
5996 {{{|
5997 <u class="&#124;">}}}} &gt;
5998 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
5999
6000 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
6001 <tr>
6002 <td></u>
6003 </td>
6004 </tr>
6005 </table>
6006
6007 !! end
6008
6009 # Note: the current result listed for this is not what the original one was,
6010 # but the original bug was JavaScript injection, which is fixed in any case.
6011 # It's not clear that the original result listed was any more correct than the
6012 # current one. Original result:
6013 # <p>{{{|
6014 # </p>
6015 # <li class="&#124;&#124;">
6016 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6017 !!test
6018 Fuzz testing: Parser25 (bug 6055)
6019 !! input
6020 {{{
6021 |
6022 <LI CLASS=||
6023 >
6024 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
6025 !! result
6026 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
6027 </p>
6028 !! end
6029
6030 !!test
6031 Fuzz testing: URL adjacent extension (with space, clean)
6032 !! options
6033 !! input
6034 http://example.com <nowiki>junk</nowiki>
6035 !! result
6036 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
6037 </p>
6038 !!end
6039
6040 !!test
6041 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
6042 !! options
6043 !! input
6044 http://example.com<nowiki>junk</nowiki>
6045 !! result
6046 <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
6047 </p>
6048 !!end
6049
6050 !!test
6051 Fuzz testing: URL adjacent extension (no space, dirty; pre)
6052 !! options
6053 !! input
6054 http://example.com<pre>junk</pre>
6055 !! result
6056 <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
6057
6058 !!end
6059
6060 !!test
6061 Fuzz testing: image with bogus manual thumbnail
6062 !!input
6063 [[Image:foobar.jpg|thumbnail= ]]
6064 !!result
6065 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
6066
6067 !!end
6068
6069 !! test
6070 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
6071 !! input
6072 <pre dir="&#10;"></pre>
6073 !! result
6074 <pre dir="&#10;"></pre>
6075
6076 !! end
6077
6078 !! test
6079 Parsing optional HTML elements (Bug 6171)
6080 !! options
6081 !! input
6082 <table>
6083 <tr>
6084 <td> Some tabular data</td>
6085 <td> More tabular data ...
6086 <td> And yet som tabular data</td>
6087 </tr>
6088 </table>
6089 !! result
6090 <table>
6091 <tr>
6092 <td> Some tabular data</td>
6093 <td> More tabular data ...
6094 </td><td> And yet som tabular data</td>
6095 </tr>
6096 </table>
6097
6098 !! end
6099
6100 !! test
6101 Correct handling of <td>, <tr> (Bug 6171)
6102 !! options
6103 !! input
6104 <table>
6105 <tr>
6106 <td> Some tabular data</td>
6107 <td> More tabular data ...</td>
6108 <td> And yet som tabular data</td>
6109 </tr>
6110 </table>
6111 !! result
6112 <table>
6113 <tr>
6114 <td> Some tabular data</td>
6115 <td> More tabular data ...</td>
6116 <td> And yet som tabular data</td>
6117 </tr>
6118 </table>
6119
6120 !! end
6121
6122
6123 !! test
6124 Parsing crashing regression (fr:JavaScript)
6125 !! input
6126 </body></x>
6127 !! result
6128 <p>&lt;/body&gt;&lt;/x&gt;
6129 </p>
6130 !! end
6131
6132 !! test
6133 Inline wiki vs wiki block nesting
6134 !! input
6135 '''Bold paragraph
6136
6137 New wiki paragraph
6138 !! result
6139 <p><b>Bold paragraph</b>
6140 </p><p>New wiki paragraph
6141 </p>
6142 !! end
6143
6144 !! test
6145 Inline HTML vs wiki block nesting
6146 !! options
6147 disabled
6148 !! input
6149 <b>Bold paragraph
6150
6151 New wiki paragraph
6152 !! result
6153 <p><b>Bold paragraph</b>
6154 </p><p>New wiki paragraph
6155 </p>
6156 !! end
6157
6158 # Original result was this:
6159 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
6160 # </p>
6161 # While that might be marginally more intuitive, maybe, the six-apostrophe
6162 # construct is clearly pathological and the result stated here (which is what
6163 # the parser actually does) is about as reasonable as anything.
6164 !!test
6165 Mixing markup for italics and bold
6166 !! options
6167 !! input
6168 '''bold''''''bold''bolditalics'''''
6169 !! result
6170 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
6171 </p>
6172 !! end
6173
6174
6175 !! article
6176 Xyzzyx
6177 !! text
6178 Article for special page transclusion test
6179 !! endarticle
6180
6181 !! test
6182 Special page transclusion
6183 !! options
6184 !! input
6185 {{Special:Prefixindex/Xyzzyx}}
6186 !! result
6187 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6188
6189 !! end
6190
6191 !! test
6192 Special page transclusion twice (bug 5021)
6193 !! options
6194 !! input
6195 {{Special:Prefixindex/Xyzzyx}}
6196 {{Special:Prefixindex/Xyzzyx}}
6197 !! result
6198 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6199 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6200
6201 !! end
6202
6203 !! test
6204 Transclusion of default MediaWiki message
6205 !! input
6206 {{MediaWiki:Mainpage}}
6207 !!result
6208 <p>Main Page
6209 </p>
6210 !! end
6211
6212 !! test
6213 Transclusion of nonexistent MediaWiki message
6214 !! input
6215 {{MediaWiki:Mainpagexxx}}
6216 !!result
6217 <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>
6218 </p>
6219 !! end
6220
6221 !! test
6222 Transclusion of MediaWiki message with underscore
6223 !! input
6224 {{MediaWiki:history_short}}
6225 !! result
6226 <p>History
6227 </p>
6228 !! end
6229
6230 !! test
6231 Transclusion of MediaWiki message with space
6232 !! input
6233 {{MediaWiki:history short}}
6234 !! result
6235 <p>History
6236 </p>
6237 !! end
6238
6239 !! test
6240 Invalid header with following text
6241 !! input
6242 = x = y
6243 !! result
6244 <p>= x = y
6245 </p>
6246 !! end
6247
6248
6249 !! test
6250 Section extraction test (section 0)
6251 !! options
6252 section=0
6253 !! input
6254 start
6255 ==a==
6256 ===aa===
6257 ====aaa====
6258 ==b==
6259 ===ba===
6260 ===bb===
6261 ====bba====
6262 ===bc===
6263 ==c==
6264 ===ca===
6265 !! result
6266 start
6267 !! end
6268
6269 !! test
6270 Section extraction test (section 1)
6271 !! options
6272 section=1
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 ==a==
6287 ===aa===
6288 ====aaa====
6289 !! end
6290
6291 !! test
6292 Section extraction test (section 2)
6293 !! options
6294 section=2
6295 !! input
6296 start
6297 ==a==
6298 ===aa===
6299 ====aaa====
6300 ==b==
6301 ===ba===
6302 ===bb===
6303 ====bba====
6304 ===bc===
6305 ==c==
6306 ===ca===
6307 !! result
6308 ===aa===
6309 ====aaa====
6310 !! end
6311
6312 !! test
6313 Section extraction test (section 3)
6314 !! options
6315 section=3
6316 !! input
6317 start
6318 ==a==
6319 ===aa===
6320 ====aaa====
6321 ==b==
6322 ===ba===
6323 ===bb===
6324 ====bba====
6325 ===bc===
6326 ==c==
6327 ===ca===
6328 !! result
6329 ====aaa====
6330 !! end
6331
6332 !! test
6333 Section extraction test (section 4)
6334 !! options
6335 section=4
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 ==b==
6350 ===ba===
6351 ===bb===
6352 ====bba====
6353 ===bc===
6354 !! end
6355
6356 !! test
6357 Section extraction test (section 5)
6358 !! options
6359 section=5
6360 !! input
6361 start
6362 ==a==
6363 ===aa===
6364 ====aaa====
6365 ==b==
6366 ===ba===
6367 ===bb===
6368 ====bba====
6369 ===bc===
6370 ==c==
6371 ===ca===
6372 !! result
6373 ===ba===
6374 !! end
6375
6376 !! test
6377 Section extraction test (section 6)
6378 !! options
6379 section=6
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 ===bb===
6394 ====bba====
6395 !! end
6396
6397 !! test
6398 Section extraction test (section 7)
6399 !! options
6400 section=7
6401 !! input
6402 start
6403 ==a==
6404 ===aa===
6405 ====aaa====
6406 ==b==
6407 ===ba===
6408 ===bb===
6409 ====bba====
6410 ===bc===
6411 ==c==
6412 ===ca===
6413 !! result
6414 ====bba====
6415 !! end
6416
6417 !! test
6418 Section extraction test (section 8)
6419 !! options
6420 section=8
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 ===bc===
6435 !! end
6436
6437 !! test
6438 Section extraction test (section 9)
6439 !! options
6440 section=9
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 ==c==
6455 ===ca===
6456 !! end
6457
6458 !! test
6459 Section extraction test (section 10)
6460 !! options
6461 section=10
6462 !! input
6463 start
6464 ==a==
6465 ===aa===
6466 ====aaa====
6467 ==b==
6468 ===ba===
6469 ===bb===
6470 ====bba====
6471 ===bc===
6472 ==c==
6473 ===ca===
6474 !! result
6475 ===ca===
6476 !! end
6477
6478 !! test
6479 Section extraction test (nonexistent section 11)
6480 !! options
6481 section=11
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 !! end
6496
6497 !! test
6498 Section extraction test with bogus heading (section 1)
6499 !! options
6500 section=1
6501 !! input
6502 ==a==
6503 ==bogus== not a legal section
6504 ==b==
6505 !! result
6506 ==a==
6507 ==bogus== not a legal section
6508 !! end
6509
6510 !! test
6511 Section extraction test with bogus heading (section 2)
6512 !! options
6513 section=2
6514 !! input
6515 ==a==
6516 ==bogus== not a legal section
6517 ==b==
6518 !! result
6519 ==b==
6520 !! end
6521
6522 !! test
6523 Section extraction test with comment after heading (section 1)
6524 !! options
6525 section=1
6526 !! input
6527 ==a==
6528 ==b== <!-- -->
6529 ==c==
6530 !! result
6531 ==a==
6532 !! end
6533
6534 !! test
6535 Section extraction test with comment after heading (section 2)
6536 !! options
6537 section=2
6538 !! input
6539 ==a==
6540 ==b== <!-- -->
6541 ==c==
6542 !! result
6543 ==b== <!-- -->
6544 !! end
6545
6546 !! test
6547 Section extraction test with bogus <nowiki> heading (section 1)
6548 !! options
6549 section=1
6550 !! input
6551 ==a==
6552 ==bogus== <nowiki>not a legal section</nowiki>
6553 ==b==
6554 !! result
6555 ==a==
6556 ==bogus== <nowiki>not a legal section</nowiki>
6557 !! end
6558
6559 !! test
6560 Section extraction test with bogus <nowiki> heading (section 2)
6561 !! options
6562 section=2
6563 !! input
6564 ==a==
6565 ==bogus== <nowiki>not a legal section</nowiki>
6566 ==b==
6567 !! result
6568 ==b==
6569 !! end
6570
6571
6572 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
6573 # instead of respecting commented sections
6574 !! test
6575 Section extraction prefixed by comment (section 1)
6576 !! options
6577 section=1
6578 !! input
6579 <!-- -->==sec1==
6580 ==sec2==
6581 !!result
6582 ==sec2==
6583 !!end
6584
6585 !! test
6586 Section extraction prefixed by comment (section 2)
6587 !! options
6588 section=2
6589 !! input
6590 <!-- -->==sec1==
6591 ==sec2==
6592 !!result
6593
6594 !!end
6595
6596
6597 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
6598 # instead of respecting HTML-style headings
6599 !! test
6600 Section extraction, mixed wiki and html (section 1)
6601 !! options
6602 section=1
6603 !! input
6604 <h2>unmarked</h2>
6605 unmarked
6606 ==1==
6607 one
6608 ==2==
6609 two
6610 !! result
6611 ==1==
6612 one
6613 !! end
6614
6615 !! test
6616 Section extraction, mixed wiki and html (section 2)
6617 !! options
6618 section=2
6619 !! input
6620 <h2>unmarked</h2>
6621 unmarked
6622 ==1==
6623 one
6624 ==2==
6625 two
6626 !! result
6627 ==2==
6628 two
6629 !! end
6630
6631
6632 # Formerly testing for bug 3342
6633 !! test
6634 Section extraction, heading surrounded by <noinclude>
6635 !! options
6636 section=1
6637 !! input
6638 <noinclude>==unmarked==</noinclude>
6639 ==marked==
6640 !! result
6641 ==marked==
6642 !!end
6643
6644 # Test behaviour of bug 19910
6645 !! test
6646 Sectiion with all-equals
6647 !! options
6648 section=2
6649 !! input
6650 ===
6651 The line above must have a trailing space
6652 === <!--
6653 --> <!-- -->
6654 But just in case it doesn't...
6655 !! result
6656 === <!--
6657 --> <!-- -->
6658 But just in case it doesn't...
6659 !! end
6660
6661 !! test
6662 Section replacement test (section 0)
6663 !! options
6664 replace=0,"xxx"
6665 !! input
6666 start
6667 ==a==
6668 ===aa===
6669 ====aaa====
6670 ==b==
6671 ===ba===
6672 ===bb===
6673 ====bba====
6674 ===bc===
6675 ==c==
6676 ===ca===
6677 !! result
6678 xxx
6679
6680 ==a==
6681 ===aa===
6682 ====aaa====
6683 ==b==
6684 ===ba===
6685 ===bb===
6686 ====bba====
6687 ===bc===
6688 ==c==
6689 ===ca===
6690 !! end
6691
6692 !! test
6693 Section replacement test (section 1)
6694 !! options
6695 replace=1,"xxx"
6696 !! input
6697 start
6698 ==a==
6699 ===aa===
6700 ====aaa====
6701 ==b==
6702 ===ba===
6703 ===bb===
6704 ====bba====
6705 ===bc===
6706 ==c==
6707 ===ca===
6708 !! result
6709 start
6710 xxx
6711
6712 ==b==
6713 ===ba===
6714 ===bb===
6715 ====bba====
6716 ===bc===
6717 ==c==
6718 ===ca===
6719 !! end
6720
6721 !! test
6722 Section replacement test (section 2)
6723 !! options
6724 replace=2,"xxx"
6725 !! input
6726 start
6727 ==a==
6728 ===aa===
6729 ====aaa====
6730 ==b==
6731 ===ba===
6732 ===bb===
6733 ====bba====
6734 ===bc===
6735 ==c==
6736 ===ca===
6737 !! result
6738 start
6739 ==a==
6740 xxx
6741
6742 ==b==
6743 ===ba===
6744 ===bb===
6745 ====bba====
6746 ===bc===
6747 ==c==
6748 ===ca===
6749 !! end
6750
6751 !! test
6752 Section replacement test (section 3)
6753 !! options
6754 replace=3,"xxx"
6755 !! input
6756 start
6757 ==a==
6758 ===aa===
6759 ====aaa====
6760 ==b==
6761 ===ba===
6762 ===bb===
6763 ====bba====
6764 ===bc===
6765 ==c==
6766 ===ca===
6767 !! result
6768 start
6769 ==a==
6770 ===aa===
6771 xxx
6772
6773 ==b==
6774 ===ba===
6775 ===bb===
6776 ====bba====
6777 ===bc===
6778 ==c==
6779 ===ca===
6780 !! end
6781
6782 !! test
6783 Section replacement test (section 4)
6784 !! options
6785 replace=4,"xxx"
6786 !! input
6787 start
6788 ==a==
6789 ===aa===
6790 ====aaa====
6791 ==b==
6792 ===ba===
6793 ===bb===
6794 ====bba====
6795 ===bc===
6796 ==c==
6797 ===ca===
6798 !! result
6799 start
6800 ==a==
6801 ===aa===
6802 ====aaa====
6803 xxx
6804
6805 ==c==
6806 ===ca===
6807 !! end
6808
6809 !! test
6810 Section replacement test (section 5)
6811 !! options
6812 replace=5,"xxx"
6813 !! input
6814 start
6815 ==a==
6816 ===aa===
6817 ====aaa====
6818 ==b==
6819 ===ba===
6820 ===bb===
6821 ====bba====
6822 ===bc===
6823 ==c==
6824 ===ca===
6825 !! result
6826 start
6827 ==a==
6828 ===aa===
6829 ====aaa====
6830 ==b==
6831 xxx
6832
6833 ===bb===
6834 ====bba====
6835 ===bc===
6836 ==c==
6837 ===ca===
6838 !! end
6839
6840 !! test
6841 Section replacement test (section 6)
6842 !! options
6843 replace=6,"xxx"
6844 !! input
6845 start
6846 ==a==
6847 ===aa===
6848 ====aaa====
6849 ==b==
6850 ===ba===
6851 ===bb===
6852 ====bba====
6853 ===bc===
6854 ==c==
6855 ===ca===
6856 !! result
6857 start
6858 ==a==
6859 ===aa===
6860 ====aaa====
6861 ==b==
6862 ===ba===
6863 xxx
6864
6865 ===bc===
6866 ==c==
6867 ===ca===
6868 !! end
6869
6870 !! test
6871 Section replacement test (section 7)
6872 !! options
6873 replace=7,"xxx"
6874 !! input
6875 start
6876 ==a==
6877 ===aa===
6878 ====aaa====
6879 ==b==
6880 ===ba===
6881 ===bb===
6882 ====bba====
6883 ===bc===
6884 ==c==
6885 ===ca===
6886 !! result
6887 start
6888 ==a==
6889 ===aa===
6890 ====aaa====
6891 ==b==
6892 ===ba===
6893 ===bb===
6894 xxx
6895
6896 ===bc===
6897 ==c==
6898 ===ca===
6899 !! end
6900
6901 !! test
6902 Section replacement test (section 8)
6903 !! options
6904 replace=8,"xxx"
6905 !! input
6906 start
6907 ==a==
6908 ===aa===
6909 ====aaa====
6910 ==b==
6911 ===ba===
6912 ===bb===
6913 ====bba====
6914 ===bc===
6915 ==c==
6916 ===ca===
6917 !! result
6918 start
6919 ==a==
6920 ===aa===
6921 ====aaa====
6922 ==b==
6923 ===ba===
6924 ===bb===
6925 ====bba====
6926 xxx
6927
6928 ==c==
6929 ===ca===
6930 !!end
6931
6932 !! test
6933 Section replacement test (section 9)
6934 !! options
6935 replace=9,"xxx"
6936 !! input
6937 start
6938 ==a==
6939 ===aa===
6940 ====aaa====
6941 ==b==
6942 ===ba===
6943 ===bb===
6944 ====bba====
6945 ===bc===
6946 ==c==
6947 ===ca===
6948 !! result
6949 start
6950 ==a==
6951 ===aa===
6952 ====aaa====
6953 ==b==
6954 ===ba===
6955 ===bb===
6956 ====bba====
6957 ===bc===
6958 xxx
6959 !! end
6960
6961 !! test
6962 Section replacement test (section 10)
6963 !! options
6964 replace=10,"xxx"
6965 !! input
6966 start
6967 ==a==
6968 ===aa===
6969 ====aaa====
6970 ==b==
6971 ===ba===
6972 ===bb===
6973 ====bba====
6974 ===bc===
6975 ==c==
6976 ===ca===
6977 !! result
6978 start
6979 ==a==
6980 ===aa===
6981 ====aaa====
6982 ==b==
6983 ===ba===
6984 ===bb===
6985 ====bba====
6986 ===bc===
6987 ==c==
6988 xxx
6989 !! end
6990
6991 !! test
6992 Section replacement test with initial whitespace (bug 13728)
6993 !! options
6994 replace=2,"xxx"
6995 !! input
6996 Preformatted initial line
6997 ==a==
6998 ===a===
6999 !! result
7000 Preformatted initial line
7001 ==a==
7002 xxx
7003 !! end
7004
7005
7006 !! test
7007 Section extraction, heading followed by pre with 20 spaces (bug 6398)
7008 !! options
7009 section=1
7010 !! input
7011 ==a==
7012 a
7013 !! result
7014 ==a==
7015 a
7016 !! end
7017
7018 !! test
7019 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
7020 !! options
7021 section=1
7022 !! input
7023 ==a==
7024 a
7025 !! result
7026 ==a==
7027 a
7028 !! end
7029
7030
7031 !! test
7032 Section extraction, <pre> around bogus header (bug 10309)
7033 !! options
7034 noxml section=2
7035 !! input
7036 == Section One ==
7037 <pre>
7038 =======
7039 </pre>
7040
7041 == Section Two ==
7042 stuff
7043 !! result
7044 == Section Two ==
7045 stuff
7046 !! end
7047
7048 !! test
7049 Section replacement, <pre> around bogus header (bug 10309)
7050 !! options
7051 noxml replace=2,"xxx"
7052 !! input
7053 == Section One ==
7054 <pre>
7055 =======
7056 </pre>
7057
7058 == Section Two ==
7059 stuff
7060 !! result
7061 == Section One ==
7062 <pre>
7063 =======
7064 </pre>
7065
7066 xxx
7067 !! end
7068
7069
7070
7071 !! test
7072 Handling of &#x0A; in URLs
7073 !! input
7074 **irc://&#x0A;a
7075 !! result
7076 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
7077 </li></ul>
7078 </li></ul>
7079
7080 !!end
7081
7082 !! test
7083 5 quotes, code coverage +1 line
7084 !! input
7085 '''''
7086 !! result
7087 !! end
7088
7089 !! test
7090 Special:Search page linking.
7091 !! input
7092 {{Special:search}}
7093 !! result
7094 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
7095 </p>
7096 !! end
7097
7098 !! test
7099 Say the magic word
7100 !! input
7101 * {{PAGENAME}}
7102 * {{BASEPAGENAME}}
7103 * {{SUBPAGENAME}}
7104 * {{SUBPAGENAMEE}}
7105 * {{BASEPAGENAME}}
7106 * {{BASEPAGENAMEE}}
7107 * {{TALKPAGENAME}}
7108 * {{TALKPAGENAMEE}}
7109 * {{SUBJECTPAGENAME}}
7110 * {{SUBJECTPAGENAMEE}}
7111 * {{NAMESPACEE}}
7112 * {{NAMESPACE}}
7113 * {{TALKSPACE}}
7114 * {{TALKSPACEE}}
7115 * {{SUBJECTSPACE}}
7116 * {{SUBJECTSPACEE}}
7117 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
7118 !! result
7119 <ul><li> Parser test
7120 </li><li> Parser test
7121 </li><li> Parser test
7122 </li><li> Parser_test
7123 </li><li> Parser test
7124 </li><li> Parser_test
7125 </li><li> Talk:Parser test
7126 </li><li> Talk:Parser_test
7127 </li><li> Parser test
7128 </li><li> Parser_test
7129 </li><li>
7130 </li><li>
7131 </li><li> Talk
7132 </li><li> Talk
7133 </li><li>
7134 </li><li>
7135 </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>
7136 </li></ul>
7137
7138 !! end
7139 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
7140
7141 !! test
7142 Gallery
7143 !! input
7144 <gallery>
7145 image1.png |
7146 image2.gif|||||
7147
7148 image3|
7149 image4 |300px| centre
7150 image5.svg| http://///////
7151 [[x|xx]]]]
7152 * image6
7153 </gallery>
7154 !! result
7155 <ul class="gallery">
7156 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7157 <div style="height: 150px;">Image1.png</div>
7158 <div class="gallerytext">
7159 </div>
7160 </div></li>
7161 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7162 <div style="height: 150px;">Image2.gif</div>
7163 <div class="gallerytext">
7164 <p>||||
7165 </p>
7166 </div>
7167 </div></li>
7168 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7169 <div style="height: 150px;">Image3</div>
7170 <div class="gallerytext">
7171 </div>
7172 </div></li>
7173 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7174 <div style="height: 150px;">Image4</div>
7175 <div class="gallerytext">
7176 <p>300px| centre
7177 </p>
7178 </div>
7179 </div></li>
7180 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7181 <div style="height: 150px;">Image5.svg</div>
7182 <div class="gallerytext">
7183 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
7184 </p>
7185 </div>
7186 </div></li>
7187 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7188 <div style="height: 150px;">* image6</div>
7189 <div class="gallerytext">
7190 </div>
7191 </div></li>
7192 </ul>
7193
7194 !! end
7195
7196 !! test
7197 Gallery (with options)
7198 !! input
7199 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
7200 File:Nonexistant.jpg|caption
7201 File:Nonexistant.jpg
7202 image:foobar.jpg|some '''caption''' [[Main Page]]
7203 image:foobar.jpg
7204 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
7205 </gallery>
7206 !! result
7207 <ul class="gallery" style="max-width: 226px;_width: 226px;">
7208 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
7209 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7210 <div style="height: 70px;">Nonexistant.jpg</div>
7211 <div class="gallerytext">
7212 <p>caption
7213 </p>
7214 </div>
7215 </div></li>
7216 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7217 <div style="height: 70px;">Nonexistant.jpg</div>
7218 <div class="gallerytext">
7219 </div>
7220 </div></li>
7221 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7222 <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>
7223 <div class="gallerytext">
7224 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7225 </p>
7226 </div>
7227 </div></li>
7228 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7229 <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>
7230 <div class="gallerytext">
7231 </div>
7232 </div></li>
7233 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7234 <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>
7235 <div class="gallerytext">
7236 <p>Blabla|blabla.
7237 </p>
7238 </div>
7239 </div></li>
7240 </ul>
7241
7242 !! end
7243
7244 !! test
7245 Gallery with wikitext inside caption
7246 !! input
7247 <gallery>
7248 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
7249 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
7250 </gallery>
7251 !! result
7252 <ul class="gallery">
7253 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7254 <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>
7255 <div class="gallerytext">
7256 <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>
7257 </p>
7258 </div>
7259 </div></li>
7260 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7261 <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>
7262 <div class="gallerytext">
7263 <p>This is a test template
7264 </p>
7265 </div>
7266 </div></li>
7267 </ul>
7268
7269 !! end
7270
7271 !! test
7272 gallery (with showfilename option)
7273 !! input
7274 <gallery showfilename>
7275 File:Nonexistant.jpg|caption
7276 File:Nonexistant.jpg
7277 image:foobar.jpg|some '''caption''' [[Main Page]]
7278 File:Foobar.jpg
7279 </gallery>
7280 !! result
7281 <ul class="gallery">
7282 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7283 <div style="height: 150px;">Nonexistant.jpg</div>
7284 <div class="gallerytext">
7285 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7286 caption
7287 </p>
7288 </div>
7289 </div></li>
7290 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7291 <div style="height: 150px;">Nonexistant.jpg</div>
7292 <div class="gallerytext">
7293 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7294 </p>
7295 </div>
7296 </div></li>
7297 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7298 <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>
7299 <div class="gallerytext">
7300 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7301 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7302 </p>
7303 </div>
7304 </div></li>
7305 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7306 <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>
7307 <div class="gallerytext">
7308 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7309 </p>
7310 </div>
7311 </div></li>
7312 </ul>
7313
7314 !! end
7315
7316 !! test
7317 Gallery (with namespace-less filenames)
7318 !! input
7319 <gallery>
7320 File:Nonexistant.jpg
7321 Nonexistant.jpg
7322 image:foobar.jpg
7323 foobar.jpg
7324 </gallery>
7325 !! result
7326 <ul class="gallery">
7327 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7328 <div style="height: 150px;">Nonexistant.jpg</div>
7329 <div class="gallerytext">
7330 </div>
7331 </div></li>
7332 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7333 <div style="height: 150px;">Nonexistant.jpg</div>
7334 <div class="gallerytext">
7335 </div>
7336 </div></li>
7337 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7338 <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>
7339 <div class="gallerytext">
7340 </div>
7341 </div></li>
7342 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7343 <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>
7344 <div class="gallerytext">
7345 </div>
7346 </div></li>
7347 </ul>
7348
7349 !! end
7350
7351 !! test
7352 HTML Hex character encoding (spells the word "JavaScript")
7353 !! input
7354 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
7355 !! result
7356 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
7357 </p>
7358 !! end
7359
7360 !! test
7361 HTML Hex character encoding bogus encoding (bug 26437 regression check)
7362 !! input
7363 &#xsee;&#XSEE;
7364 !! result
7365 <p>&amp;#xsee;&amp;#XSEE;
7366 </p>
7367 !! end
7368
7369 !! test
7370 HTML Hex character encoding mixed case
7371 !! input
7372 &#xEE;&#Xee;
7373 !! result
7374 <p>&#xee;&#xee;
7375 </p>
7376 !! end
7377
7378 !! test
7379 __FORCETOC__ override
7380 !! input
7381 __NEWSECTIONLINK__
7382 __FORCETOC__
7383 !! result
7384 <p><br />
7385 </p>
7386 !! end
7387
7388 !! test
7389 ISBN code coverage
7390 !! input
7391 ISBN 978-0-1234-56&#x20;789
7392 !! result
7393 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
7394 </p>
7395 !! end
7396
7397 !! test
7398 ISBN followed by 5 spaces
7399 !! input
7400 ISBN
7401 !! result
7402 <p>ISBN
7403 </p>
7404 !! end
7405
7406 !! test
7407 Double ISBN
7408 !! input
7409 ISBN ISBN 1234567890
7410 !! result
7411 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7412 </p>
7413 !! end
7414
7415 !! test
7416 Bug 22905: <abbr> followed by ISBN followed by </a>
7417 !! input
7418 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
7419 !! result
7420 <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>
7421 </p>
7422 !! end
7423
7424 !! test
7425 Double RFC
7426 !! input
7427 RFC RFC 1234
7428 !! result
7429 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
7430 </p>
7431 !! end
7432
7433 !! test
7434 Double RFC with a wiki link
7435 !! input
7436 RFC [[RFC 1234]]
7437 !! result
7438 <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>
7439 </p>
7440 !! end
7441
7442 !! test
7443 RFC code coverage
7444 !! input
7445 RFC 983&#x20;987
7446 !! result
7447 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
7448 </p>
7449 !! end
7450
7451 !! test
7452 Centre-aligned image
7453 !! input
7454 [[Image:foobar.jpg|centre]]
7455 !! result
7456 <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>
7457
7458 !!end
7459
7460 !! test
7461 None-aligned image
7462 !! input
7463 [[Image:foobar.jpg|none]]
7464 !! result
7465 <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>
7466
7467 !!end
7468
7469 !! test
7470 Width + Height sized image (using px) (height is ignored)
7471 !! input
7472 [[Image:foobar.jpg|640x480px]]
7473 !! result
7474 <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>
7475 </p>
7476 !!end
7477
7478 !! test
7479 Width-sized image (using px, no following whitespace)
7480 !! input
7481 [[Image:foobar.jpg|640px]]
7482 !! result
7483 <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>
7484 </p>
7485 !!end
7486
7487 !! test
7488 Width-sized image (using px, with following whitespace - test regression from r39467)
7489 !! input
7490 [[Image:foobar.jpg|640px ]]
7491 !! result
7492 <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>
7493 </p>
7494 !!end
7495
7496 !! test
7497 Width-sized image (using px, with preceding whitespace - test regression from r39467)
7498 !! input
7499 [[Image:foobar.jpg| 640px]]
7500 !! result
7501 <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>
7502 </p>
7503 !!end
7504
7505 !! test
7506 Another italics / bold test
7507 !! input
7508 ''' ''x'
7509 !! result
7510 <pre>'<i> </i>x'
7511 </pre>
7512 !!end
7513
7514 # Note the results may be incorrect, as parserTest output included this:
7515 # XML error: Mismatched tag at byte 6120:
7516 # ...<dd> </dt></dl> </dd...
7517 !! test
7518 dt/dd/dl test
7519 !! options
7520 disabled
7521 !! input
7522 :;;;::
7523 !! result
7524 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
7525 </dd></dl>
7526 </dd></dl>
7527 </dt></dl>
7528 </dt></dl>
7529 </dt></dl>
7530 </dd></dl>
7531
7532 !!end
7533
7534
7535 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
7536 !! test
7537 Images with the "|" character in the comment
7538 !! input
7539 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
7540 !! result
7541 <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>
7542
7543 !!end
7544
7545 !! test
7546 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
7547 !! input
7548 <html><script>alert(1);</script></html>
7549 !! result
7550 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
7551 </p>
7552 !! end
7553
7554 !! test
7555 HTML with raw HTML ($wgRawHtml==true)
7556 !! options
7557 rawhtml
7558 !! input
7559 <html><script>alert(1);</script></html>
7560 !! result
7561 <p><script>alert(1);</script>
7562 </p>
7563 !! end
7564
7565 !! test
7566 Parents of subpages, one level up
7567 !! options
7568 subpage title=[[Subpage test/L1/L2/L3]]
7569 !! input
7570 [[../|L2]]
7571 !! result
7572 <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>
7573 </p>
7574 !! end
7575
7576
7577 !! test
7578 Parents of subpages, one level up, not named
7579 !! options
7580 subpage title=[[Subpage test/L1/L2/L3]]
7581 !! input
7582 [[../]]
7583 !! result
7584 <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>
7585 </p>
7586 !! end
7587
7588
7589
7590 !! test
7591 Parents of subpages, two levels up
7592 !! options
7593 subpage title=[[Subpage test/L1/L2/L3]]
7594 !! input
7595 [[../../|L1]]2
7596
7597 [[../../|L1]]l
7598 !! result
7599 <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
7600 </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>
7601 </p>
7602 !! end
7603
7604 !! test
7605 Parents of subpages, two levels up, without trailing slash or name.
7606 !! options
7607 subpage title=[[Subpage test/L1/L2/L3]]
7608 !! input
7609 [[../..]]
7610 !! result
7611 <p>[[../..]]
7612 </p>
7613 !! end
7614
7615 !! test
7616 Parents of subpages, two levels up, with lots of extra trailing slashes.
7617 !! options
7618 subpage title=[[Subpage test/L1/L2/L3]]
7619 !! input
7620 [[../../////]]
7621 !! result
7622 <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>
7623 </p>
7624 !! end
7625
7626 !! test
7627 Definition list code coverage
7628 !! input
7629 ; title : def
7630 ; title : def
7631 ;title: def
7632 !! result
7633 <dl><dt> title &#160;</dt><dd> def
7634 </dd><dt> title&#160;</dt><dd> def
7635 </dd><dt>title</dt><dd> def
7636 </dd></dl>
7637
7638 !! end
7639
7640 !! test
7641 Don't fall for the self-closing div
7642 !! input
7643 <div>hello world</div/>
7644 !! result
7645 <div>hello world</div>
7646
7647 !! end
7648
7649 !! test
7650 MSGNW magic word
7651 !! input
7652 {{MSGNW:msg}}
7653 !! result
7654 <p>&#91;&#91;:Template:Msg&#93;&#93;
7655 </p>
7656 !! end
7657
7658 !! test
7659 RAW magic word
7660 !! input
7661 {{RAW:QUERTY}}
7662 !! result
7663 <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>
7664 </p>
7665 !! end
7666
7667 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
7668 !! test
7669 Always escape literal '>' in output, not just after '<'
7670 !! input
7671 ><>
7672 !! result
7673 <p>&gt;&lt;&gt;
7674 </p>
7675 !! end
7676
7677 !! test
7678 Template caching
7679 !! input
7680 {{Test}}
7681 {{Test}}
7682 !! result
7683 <p>This is a test template
7684 This is a test template
7685 </p>
7686 !! end
7687
7688
7689 !! article
7690 MediaWiki:Fake
7691 !! text
7692 ==header==
7693 !! endarticle
7694
7695 !! test
7696 Inclusion of !userCanEdit() content
7697 !! input
7698 {{MediaWiki:Fake}}
7699 !! result
7700 <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>
7701
7702 !! end
7703
7704
7705 !! test
7706 Out-of-order TOC heading levels
7707 !! input
7708 ==2==
7709 ======6======
7710 ===3===
7711 =1=
7712 =====5=====
7713 ==2==
7714 !! result
7715 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7716 <ul>
7717 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
7718 <ul>
7719 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
7720 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
7721 </ul>
7722 </li>
7723 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
7724 <ul>
7725 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
7726 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
7727 </ul>
7728 </li>
7729 </ul>
7730 </td></tr></table>
7731 <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>
7732 <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>
7733 <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>
7734 <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>
7735 <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>
7736 <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>
7737
7738 !! end
7739
7740
7741 !! test
7742 ISBN with a dummy number
7743 !! input
7744 ISBN ---
7745 !! result
7746 <p>ISBN ---
7747 </p>
7748 !! end
7749
7750
7751 !! test
7752 ISBN with space-delimited number
7753 !! input
7754 ISBN 92 9017 032 8
7755 !! result
7756 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
7757 </p>
7758 !! end
7759
7760
7761 !! test
7762 ISBN with multiple spaces, no number
7763 !! input
7764 ISBN foo
7765 !! result
7766 <p>ISBN foo
7767 </p>
7768 !! end
7769
7770
7771 !! test
7772 ISBN length
7773 !! input
7774 ISBN 123456789
7775
7776 ISBN 1234567890
7777
7778 ISBN 12345678901
7779 !! result
7780 <p>ISBN 123456789
7781 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7782 </p><p>ISBN 12345678901
7783 </p>
7784 !! end
7785
7786
7787 !! test
7788 ISBN with trailing year (bug 8110)
7789 !! input
7790 ISBN 1-234-56789-0 - 2006
7791
7792 ISBN 1 234 56789 0 - 2006
7793 !! result
7794 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
7795 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
7796 </p>
7797 !! end
7798
7799
7800 !! test
7801 anchorencode
7802 !! input
7803 {{anchorencode:foo bar©#%n}}
7804 !! result
7805 <p>foo_bar.C2.A9.23.25n
7806 </p>
7807 !! end
7808
7809 !! test
7810 anchorencode trims spaces
7811 !! input
7812 {{anchorencode: __pretty__please__}}
7813 !! result
7814 <p>pretty_please
7815 </p>
7816 !! end
7817
7818 !! test
7819 anchorencode deals with links
7820 !! input
7821 {{anchorencode: [[hello|world]] [[hi]]}}
7822 !! result
7823 <p>world_hi
7824 </p>
7825 !! end
7826
7827 !! test
7828 anchorencode deals with templates
7829 !! input
7830 {{anchorencode: {{Foo}} }}
7831 !! result
7832 <p>FOO
7833 </p>
7834 !! end
7835
7836 !! test
7837 anchorencode encodes like the TOC generator: (bug 18431)
7838 !! input
7839 === _ +:.3A%3A&&amp;]] ===
7840 {{anchorencode: _ +:.3A%3A&&amp;]] }}
7841 __NOEDITSECTION__
7842 !! result
7843 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
7844 <p>.2B:.3A.253A.26.26.5D.5D
7845 </p>
7846 !! end
7847
7848 # Expected output in the following test is not necessarily expected (there
7849 # should probably be <p> tags inside the <blockquote> in the output) -- it's
7850 # only testing for well-formedness.
7851 !! test
7852 Bug 6200: blockquotes and paragraph formatting
7853 !! input
7854 <blockquote>
7855 foo
7856 </blockquote>
7857
7858 bar
7859
7860 baz
7861 !! result
7862 <blockquote>
7863 foo
7864 </blockquote>
7865 <p>bar
7866 </p>
7867 <pre>baz
7868 </pre>
7869 !! end
7870
7871 !! test
7872 Bug 8293: Use of center tag ruins paragraph formatting
7873 !! input
7874 <center>
7875 foo
7876 </center>
7877
7878 bar
7879
7880 baz
7881 !! result
7882 <center>
7883 <p>foo
7884 </p>
7885 </center>
7886 <p>bar
7887 </p>
7888 <pre>baz
7889 </pre>
7890 !! end
7891
7892
7893 ###
7894 ### Language variants related tests
7895 ###
7896 !! test
7897 Self-link in language variants
7898 !! options
7899 title=[[Dunav]] language=sr
7900 !! input
7901 Both [[Dunav]] and [[Дунав]] are names for this river.
7902 !! result
7903 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
7904 </p>
7905 !!end
7906
7907
7908 !! test
7909 Link to pages in language variants
7910 !! options
7911 language=sr
7912 !! input
7913 Main Page can be written as [[Маин Паге]]
7914 !! result
7915 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
7916 </p>
7917 !!end
7918
7919
7920 !! test
7921 Multiple links to pages in language variants
7922 !! options
7923 language=sr
7924 !! input
7925 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
7926 !! result
7927 <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>.
7928 </p>
7929 !!end
7930
7931
7932 !! test
7933 Simple template in language variants
7934 !! options
7935 language=sr
7936 !! input
7937 {{тест}}
7938 !! result
7939 <p>This is a test template
7940 </p>
7941 !! end
7942
7943
7944 !! test
7945 Template with explicit namespace in language variants
7946 !! options
7947 language=sr
7948 !! input
7949 {{Template:тест}}
7950 !! result
7951 <p>This is a test template
7952 </p>
7953 !! end
7954
7955
7956 !! test
7957 Basic test for template parameter in language variants
7958 !! options
7959 language=sr
7960 !! input
7961 {{парамтест|param=foo}}
7962 !! result
7963 <p>This is a test template with parameter foo
7964 </p>
7965 !! end
7966
7967
7968 !! test
7969 Simple category in language variants
7970 !! options
7971 language=sr cat
7972 !! input
7973 [[Category:МедиаWики Усер'с Гуиде]]
7974 !! result
7975 <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>
7976 !! end
7977
7978
7979 !! test
7980 Stripping -{}- tags (language variants)
7981 !! options
7982 language=sr
7983 !! input
7984 Latin proverb: -{Ne nuntium necare}-
7985 !! result
7986 <p>Latin proverb: Ne nuntium necare
7987 </p>
7988 !! end
7989
7990
7991 !! test
7992 Prevent conversion with -{}- tags (language variants)
7993 !! options
7994 language=sr variant=sr-ec
7995 !! input
7996 Latinski: -{Ne nuntium necare}-
7997 !! result
7998 <p>Латински: Ne nuntium necare
7999 </p>
8000 !! end
8001
8002
8003 !! test
8004 Prevent conversion of text with -{}- tags (language variants)
8005 !! options
8006 language=sr variant=sr-ec
8007 !! input
8008 Latinski: -{Ne nuntium necare}-
8009 !! result
8010 <p>Латински: Ne nuntium necare
8011 </p>
8012 !! end
8013
8014
8015 !! test
8016 Prevent conversion of links with -{}- tags (language variants)
8017 !! options
8018 language=sr variant=sr-ec
8019 !! input
8020 -{[[Main Page]]}-
8021 !! result
8022 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
8023 </p>
8024 !! end
8025
8026
8027 !! test
8028 -{}- tags within headlines (within html for parserConvert())
8029 !! options
8030 language=sr variant=sr-ec
8031 !! input
8032 == -{Naslov}- ==
8033 !! result
8034 <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>
8035
8036 !! end
8037
8038
8039 !! test
8040 Explicit definition of language variant alternatives
8041 !! options
8042 language=zh variant=zh-tw
8043 !! input
8044 -{zh:China;zh-tw:Taiwan}-, not China
8045 !! result
8046 <p>Taiwan, not China
8047 </p>
8048 !! end
8049
8050
8051 !! test
8052 Explicit session-wise language variant mapping (A flag and - flag)
8053 !! options
8054 language=zh variant=zh-tw
8055 !! input
8056 Taiwan is not China.
8057 But -{A|zh:China;zh-tw:Taiwan}- is China,
8058 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
8059 and -{China}- is China.
8060 !! result
8061 <p>Taiwan is not China.
8062 But Taiwan is Taiwan,
8063 (This should be stripped!)
8064 and China is China.
8065 </p>
8066 !! end
8067
8068 !! test
8069 Explicit session-wise language variant mapping (H flag for hide)
8070 !! options
8071 language=zh variant=zh-tw
8072 !! input
8073 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
8074 Taiwan is China.
8075 !! result
8076 <p>(This should be stripped!)
8077 Taiwan is Taiwan.
8078 </p>
8079 !! end
8080
8081 !! test
8082 Adding explicit conversion rule for title (T flag)
8083 !! options
8084 language=zh variant=zh-tw showtitle
8085 !! input
8086 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8087 !! result
8088 Taiwan
8089 <p>Should be stripped!
8090 </p>
8091 !! end
8092
8093 !! test
8094 Testing that changing the language variant here in the tests actually works
8095 !! options
8096 language=zh variant=zh showtitle
8097 !! input
8098 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8099 !! result
8100 China
8101 <p>Should be stripped!
8102 </p>
8103 !! end
8104
8105 !! test
8106 Bug 24072: more test on conversion rule for title
8107 !! options
8108 language=zh variant=zh-tw showtitle
8109 !! input
8110 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
8111 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
8112 !! result
8113 Taiwan
8114 <p>This should be stripped!
8115 This won't take interferes with the title rule.
8116 </p>
8117 !! end
8118
8119 !! test
8120 Raw output of variant escape tags (R flag)
8121 !! options
8122 language=zh variant=zh-tw
8123 !! input
8124 Raw: -{R|zh:China;zh-tw:Taiwan}-
8125 !! result
8126 <p>Raw: zh:China;zh-tw:Taiwan
8127 </p>
8128 !! end
8129
8130 !! test
8131 Nested using of manual convert syntax
8132 !! options
8133 language=zh variant=zh-hk
8134 !! input
8135 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
8136 !! result
8137 <p>Nested: Hello Hong Kong!
8138 </p>
8139 !! end
8140
8141 !! test
8142 Do not convert roman numbers to language variants
8143 !! options
8144 language=sr variant=sr-ec
8145 !! input
8146 Fridrih IV je car.
8147 !! result
8148 <p>Фридрих IV је цар.
8149 </p>
8150 !! end
8151
8152 !! test
8153 Unclosed language converter markup "-{"
8154 !! options
8155 language=sr
8156 !! input
8157 -{T|hello
8158 !! result
8159 <p>-{T|hello
8160 </p>
8161 !! end
8162
8163 !! test
8164 Don't convert raw rule "-{R|=&gt;}-" to "=>"
8165 !! options
8166 language=sr
8167 !! input
8168 -{R|=&gt;}-
8169 !! result
8170 <p>=&gt;
8171 </p>
8172 !!end
8173
8174 !!article
8175 Template:Bullet
8176 !!text
8177 * Bar
8178 !!endarticle
8179
8180 !! test
8181 Bug 529: Uncovered bullet
8182 !! input
8183 * Foo {{bullet}}
8184 !! result
8185 <ul><li> Foo
8186 </li><li> Bar
8187 </li></ul>
8188
8189 !! end
8190
8191 !! test
8192 Bug 529: Uncovered table already at line-start
8193 !! input
8194 x
8195
8196 {{table}}
8197 y
8198 !! result
8199 <p>x
8200 </p>
8201 <table>
8202 <tr>
8203 <td> 1 </td>
8204 <td> 2
8205 </td></tr>
8206 <tr>
8207 <td> 3 </td>
8208 <td> 4
8209 </td></tr></table>
8210 <p>y
8211 </p>
8212 !! end
8213
8214 !! test
8215 Bug 529: Uncovered bullet in parser function result
8216 !! input
8217 * Foo {{lc:{{bullet}} }}
8218 !! result
8219 <ul><li> Foo
8220 </li><li> bar
8221 </li></ul>
8222
8223 !! end
8224
8225 !! test
8226 Bug 5678: Double-parsed template argument
8227 !! input
8228 {{lc:{{{1}}}|hello}}
8229 !! result
8230 <p>{{{1}}}
8231 </p>
8232 !! end
8233
8234 !! test
8235 Bug 5678: Double-parsed template invocation
8236 !! input
8237 {{lc:{{paramtest {{!}} param = hello }} }}
8238 !! result
8239 <p>{{paramtest | param = hello }}
8240 </p>
8241 !! end
8242
8243 !! test
8244 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
8245 !! options
8246 language=cs
8247 title=[[Main Page]]
8248 !! input
8249 {{PRVNÍVELKÉ:ěščř}}
8250 {{prvnívelké:ěščř}}
8251 {{PRVNÍMALÉ:ěščř}}
8252 {{prvnímalé:ěščř}}
8253 {{MALÁ:ěščř}}
8254 {{malá:ěščř}}
8255 {{VELKÁ:ěščř}}
8256 {{velká:ěščř}}
8257 !! result
8258 <p>Ěščř
8259 Ěščř
8260 ěščř
8261 ěščř
8262 ěščř
8263 ěščř
8264 ĚŠČŘ
8265 ĚŠČŘ
8266 </p>
8267 !! end
8268
8269 !! test
8270 Morwen/13: Unclosed link followed by heading
8271 !! input
8272 [[link
8273 ==heading==
8274 !! result
8275 <p>[[link
8276 </p>
8277 <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>
8278
8279 !! end
8280
8281 !! test
8282 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
8283 !! input
8284 {{foo|
8285 =heading=
8286 !! result
8287 <p>{{foo|
8288 </p>
8289 <h1> <span class="mw-headline" id="heading">heading</span></h1>
8290
8291 !! end
8292
8293 !! test
8294 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
8295 !! input
8296 {{foo|
8297 ==heading==
8298 !! result
8299 <p>{{foo|
8300 </p>
8301 <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>
8302
8303 !! end
8304
8305 !! test
8306 Tildes in comments
8307 !! options
8308 pst
8309 !! input
8310 <!-- ~~~~ -->
8311 !! result
8312 <!-- ~~~~ -->
8313 !! end
8314
8315 !! test
8316 Paragraphs inside divs (no extra line breaks)
8317 !! input
8318 <div>Line one
8319
8320 Line two</div>
8321 !! result
8322 <div>Line one
8323 Line two</div>
8324
8325 !! end
8326
8327 !! test
8328 Paragraphs inside divs (extra line break on open)
8329 !! input
8330 <div>
8331 Line one
8332
8333 Line two</div>
8334 !! result
8335 <div>
8336 <p>Line one
8337 </p>
8338 Line two</div>
8339
8340 !! end
8341
8342 !! test
8343 Paragraphs inside divs (extra line break on close)
8344 !! input
8345 <div>Line one
8346
8347 Line two
8348 </div>
8349 !! result
8350 <div>Line one
8351 <p>Line two
8352 </p>
8353 </div>
8354
8355 !! end
8356
8357 !! test
8358 Paragraphs inside divs (extra line break on open and close)
8359 !! input
8360 <div>
8361 Line one
8362
8363 Line two
8364 </div>
8365 !! result
8366 <div>
8367 <p>Line one
8368 </p><p>Line two
8369 </p>
8370 </div>
8371
8372 !! end
8373
8374 !! test
8375 Nesting tags, paragraphs on lines which begin with <div>
8376 !! options
8377 disabled
8378 !! input
8379 <div></div><strong>A
8380 B</strong>
8381 !! result
8382 <div></div>
8383 <p><strong>A
8384 B</strong>
8385 </p>
8386 !! end
8387
8388 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
8389 !! test
8390 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
8391 !! options
8392 disabled
8393 !! input
8394 <blockquote>Line one
8395
8396 Line two</blockquote>
8397 !! result
8398 <blockquote>Line one
8399 Line two</blockquote>
8400
8401 !! end
8402
8403 !! test
8404 Bug 6200: paragraphs inside blockquotes (extra line break on open)
8405 !! options
8406 disabled
8407 !! input
8408 <blockquote>
8409 Line one
8410
8411 Line two</blockquote>
8412 !! result
8413 <blockquote>
8414 <p>Line one
8415 </p>
8416 Line two</blockquote>
8417
8418 !! end
8419
8420 !! test
8421 Bug 6200: paragraphs inside blockquotes (extra line break on close)
8422 !! options
8423 disabled
8424 !! input
8425 <blockquote>Line one
8426
8427 Line two
8428 </blockquote>
8429 !! result
8430 <blockquote>Line one
8431 <p>Line two
8432 </p>
8433 </blockquote>
8434
8435 !! end
8436
8437 !! test
8438 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
8439 !! options
8440 disabled
8441 !! input
8442 <blockquote>
8443 Line one
8444
8445 Line two
8446 </blockquote>
8447 !! result
8448 <blockquote>
8449 <p>Line one
8450 </p><p>Line two
8451 </p>
8452 </blockquote>
8453
8454 !! end
8455
8456 !! test
8457 Paragraphs inside blockquotes/divs (no extra line breaks)
8458 !! input
8459 <blockquote><div>Line one
8460
8461 Line two</div></blockquote>
8462 !! result
8463 <blockquote><div>Line one
8464 Line two</div></blockquote>
8465
8466 !! end
8467
8468 !! test
8469 Paragraphs inside blockquotes/divs (extra line break on open)
8470 !! input
8471 <blockquote><div>
8472 Line one
8473
8474 Line two</div></blockquote>
8475 !! result
8476 <blockquote><div>
8477 <p>Line one
8478 </p>
8479 Line two</div></blockquote>
8480
8481 !! end
8482
8483 !! test
8484 Paragraphs inside blockquotes/divs (extra line break on close)
8485 !! input
8486 <blockquote><div>Line one
8487
8488 Line two
8489 </div></blockquote>
8490 !! result
8491 <blockquote><div>Line one
8492 <p>Line two
8493 </p>
8494 </div></blockquote>
8495
8496 !! end
8497
8498 !! test
8499 Paragraphs inside blockquotes/divs (extra line break on open and close)
8500 !! input
8501 <blockquote><div>
8502 Line one
8503
8504 Line two
8505 </div></blockquote>
8506 !! result
8507 <blockquote><div>
8508 <p>Line one
8509 </p><p>Line two
8510 </p>
8511 </div></blockquote>
8512
8513 !! end
8514
8515 !! test
8516 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
8517 !! options
8518 wgLinkHolderBatchSize=0
8519 !! input
8520 [[meatball:1]]
8521 [[meatball:2]]
8522 [[meatball:3]]
8523 !! result
8524 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
8525 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
8526 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
8527 </p>
8528 !! end
8529
8530 !! test
8531 Free external link invading image caption
8532 !! input
8533 [[Image:Foobar.jpg|thumb|http://x|hello]]
8534 !! result
8535 <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>
8536
8537 !! end
8538
8539 !! test
8540 Bug 15196: localised external link numbers
8541 !! options
8542 language=fa
8543 !! input
8544 [http://en.wikipedia.org/]
8545 !! result
8546 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
8547 </p>
8548 !! end
8549
8550 !! test
8551 Multibyte character in padleft
8552 !! input
8553 {{padleft:-Hello|7|Æ}}
8554 !! result
8555 <p>Æ-Hello
8556 </p>
8557 !! end
8558
8559 !! test
8560 Multibyte character in padright
8561 !! input
8562 {{padright:Hello-|7|Æ}}
8563 !! result
8564 <p>Hello-Æ
8565 </p>
8566 !! end
8567
8568 !! test
8569 Formatted date
8570 !! config
8571 wgUseDynamicDates=1
8572 !! input
8573 [[2009-03-24]]
8574 !! result
8575 <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>
8576 </p>
8577 !!end
8578
8579 !!test
8580 formatdate parser function
8581 !!input
8582 {{#formatdate:2009-03-24}}
8583 !! result
8584 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
8585 </p>
8586 !! end
8587
8588 !!test
8589 formatdate parser function, with default format
8590 !!input
8591 {{#formatdate:2009-03-24|mdy}}
8592 !! result
8593 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
8594 </p>
8595 !! end
8596
8597 !! test
8598 Linked date with autoformatting disabled
8599 !! config
8600 wgUseDynamicDates=false
8601 !! input
8602 [[2009-03-24]]
8603 !! result
8604 <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>
8605 </p>
8606 !! end
8607
8608 !! test
8609 Spacing of numbers in formatted dates
8610 !! input
8611 {{#formatdate:January 15}}
8612 !! result
8613 <p><span class="mw-formatted-date" title="01-15">January 15</span>
8614 </p>
8615 !! end
8616
8617 !! test
8618 Spacing of numbers in formatted dates (linked)
8619 !! config
8620 wgUseDynamicDates=true
8621 !! input
8622 [[January 15]]
8623 !! result
8624 <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>
8625 </p>
8626 !! end
8627
8628 #
8629 #
8630 #
8631
8632 #
8633 # Edit comments
8634 #
8635
8636 !! test
8637 Edit comment with link
8638 !! options
8639 comment
8640 !! input
8641 I like the [[Main Page]] a lot
8642 !! result
8643 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
8644 !!end
8645
8646 !! test
8647 Edit comment with link and link text
8648 !! options
8649 comment
8650 !! input
8651 I like the [[Main Page|best pages]] a lot
8652 !! result
8653 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8654 !!end
8655
8656 !! test
8657 Edit comment with link and link text with suffix
8658 !! options
8659 comment
8660 !! input
8661 I like the [[Main Page|best page]]s a lot
8662 !! result
8663 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8664 !!end
8665
8666 !! test
8667 Edit comment with section link (non-local, eg in history list)
8668 !! options
8669 comment title=[[Main Page]]
8670 !! input
8671 /* External links */ removed bogus entries
8672 !! result
8673 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
8674 !!end
8675
8676 !! test
8677 Edit comment with section link and text before it (non-local, eg in history list)
8678 !! options
8679 comment title=[[Main Page]]
8680 !! input
8681 pre-comment text /* External links */ removed bogus entries
8682 !! result
8683 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>
8684 !!end
8685
8686 !! test
8687 Edit comment with section link (local, eg in diff view)
8688 !! options
8689 comment local title=[[Main Page]]
8690 !! input
8691 /* External links */ removed bogus entries
8692 !! result
8693 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
8694 !!end
8695
8696 !! test
8697 Edit comment with subpage link (bug 14080)
8698 !! options
8699 comment
8700 subpage
8701 title=[[Subpage test]]
8702 !! input
8703 Poked at a [[/subpage]] here...
8704 !! result
8705 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
8706 !!end
8707
8708 !! test
8709 Edit comment with subpage link and link text (bug 14080)
8710 !! options
8711 comment
8712 subpage
8713 title=[[Subpage test]]
8714 !! input
8715 Poked at a [[/subpage|neat little page]] here...
8716 !! result
8717 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
8718 !!end
8719
8720 !! test
8721 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
8722 !! options
8723 comment
8724 title=[[Subpage test]]
8725 !! input
8726 Poked at a [[/subpage]] here...
8727 !! result
8728 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...
8729 !!end
8730
8731 !! test
8732 Edit comment with bare anchor link (local, as on diff)
8733 !! options
8734 comment
8735 local
8736 title=[[Main Page]]
8737 !!input
8738 [[#section]]
8739 !! result
8740 <a href="#section">#section</a>
8741 !! end
8742
8743 !! test
8744 Edit comment with bare anchor link (non-local, as on history)
8745 !! options
8746 comment
8747 title=[[Main Page]]
8748 !!input
8749 [[#section]]
8750 !! result
8751 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
8752 !! end
8753
8754 !! test
8755 Anchor starting with underscore
8756 !!input
8757 [[#_ref|One]]
8758 !! result
8759 <p><a href="#_ref">One</a>
8760 </p>
8761 !! end
8762
8763 !! test
8764 Id starting with underscore
8765 !!input
8766 <div id="_ref"></div>
8767 !! result
8768 <div id="_ref"></div>
8769
8770 !! end
8771
8772 !! test
8773 Space normalisation on autocomment (bug 22784)
8774 !! options
8775 comment
8776 title=[[Main Page]]
8777 !!input
8778 /* __hello__world__ */
8779 !! result
8780 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
8781 !! end
8782
8783 !! test
8784 percent-encoding and + signs in comments (Bug 26410)
8785 !! options
8786 comment
8787 !!input
8788 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
8789 !! result
8790 <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>
8791 !! end
8792
8793 !! test
8794 Bad images - basic functionality
8795 !! options
8796 disabled
8797 !! input
8798 [[File:Bad.jpg]]
8799 !! result
8800 !! end
8801
8802 !! test
8803 Bad images - bug 16039: text after bad image disappears
8804 !! options
8805 disabled
8806 !! input
8807 Foo bar
8808 [[File:Bad.jpg]]
8809 Bar foo
8810 !! result
8811 <p>Foo bar
8812 </p><p>Bar foo
8813 </p>
8814 !! end
8815
8816 !! test
8817 Verify that displaytitle works (bug #22501) no displaytitle
8818 !! options
8819 showtitle
8820 !! config
8821 wgAllowDisplayTitle=true
8822 wgRestrictDisplayTitle=false
8823 !! input
8824 this is not the the title
8825 !! result
8826 Parser test
8827 <p>this is not the the title
8828 </p>
8829 !! end
8830
8831 !! test
8832 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
8833 !! options
8834 showtitle
8835 title=[[Screen]]
8836 !! config
8837 wgAllowDisplayTitle=true
8838 wgRestrictDisplayTitle=false
8839 !! input
8840 this is not the the title
8841 {{DISPLAYTITLE:whatever}}
8842 !! result
8843 whatever
8844 <p>this is not the the title
8845 </p>
8846 !! end
8847
8848 !! test
8849 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
8850 !! options
8851 showtitle
8852 title=[[Screen]]
8853 !! config
8854 wgAllowDisplayTitle=true
8855 wgRestrictDisplayTitle=true
8856 !! input
8857 this is not the the title
8858 {{DISPLAYTITLE:whatever}}
8859 !! result
8860 Screen
8861 <p>this is not the the title
8862 </p>
8863 !! end
8864
8865 !! test
8866 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
8867 !! options
8868 showtitle
8869 title=[[Screen]]
8870 !! config
8871 wgAllowDisplayTitle=true
8872 wgRestrictDisplayTitle=true
8873 !! input
8874 this is not the the title
8875 {{DISPLAYTITLE:screen}}
8876 !! result
8877 screen
8878 <p>this is not the the title
8879 </p>
8880 !! end
8881
8882 !! test
8883 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
8884 !! options
8885 showtitle
8886 title=[[Screen]]
8887 !! config
8888 wgAllowDisplayTitle=false
8889 !! input
8890 this is not the the title
8891 {{DISPLAYTITLE:screen}}
8892 !! result
8893 Screen
8894 <p>this is not the the title
8895 <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>
8896 </p>
8897 !! end
8898
8899 !! test
8900 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
8901 !! options
8902 showtitle
8903 title=[[Screen]]
8904 !! config
8905 wgAllowDisplayTitle=false
8906 !! input
8907 this is not the the title
8908 !! result
8909 Screen
8910 <p>this is not the the title
8911 </p>
8912 !! end
8913
8914 !! test
8915 preload: check <noinclude> and <includeonly>
8916 !! options
8917 preload
8918 !! input
8919 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
8920 !! result
8921 Hello kind world.
8922 !! end
8923
8924 !! test
8925 preload: check <onlyinclude>
8926 !! options
8927 preload
8928 !! input
8929 Goodbye <onlyinclude>Hello world</onlyinclude>
8930 !! result
8931 Hello world
8932 !! end
8933
8934 !! test
8935 preload: can pass tags through if we want to
8936 !! options
8937 preload
8938 !! input
8939 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
8940 !! result
8941 <includeonly>Hello world</includeonly>
8942 !! end
8943
8944 !! test
8945 preload: check that it doesn't try to do tricks
8946 !! options
8947 preload
8948 !! input
8949 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8950 !! result
8951 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8952 !! end
8953
8954 !! test
8955 Play a bit with r67090 and bug 3158
8956 !! options
8957 disabled
8958 !! input
8959 <div style="width:50% !important">&nbsp;</div>
8960 <div style="width:50%&nbsp;!important">&nbsp;</div>
8961 <div style="width:50%&#160;!important">&nbsp;</div>
8962 <div style="border : solid;">&nbsp;</div>
8963 !! result
8964 <div style="width:50% !important">&nbsp;</div>
8965 <div style="width:50% !important">&nbsp;</div>
8966 <div style="width:50% !important">&nbsp;</div>
8967 <div style="border&#160;: solid;">&nbsp;</div>
8968
8969 !! end
8970
8971 !! test
8972 HTML5 data attributes
8973 !! input
8974 <span data-foo="bar">Baz</span>
8975 <p data-abc-def_hij="">Quuz</p>
8976 !! result
8977 <p><span data-foo="bar">Baz</span>
8978 </p>
8979 <p data-abc-def_hij="">Quuz</p>
8980
8981 !! end
8982
8983 !! test
8984 percent-encoding and + signs in internal links (Bug 26410)
8985 !! input
8986 [[User:+%]] [[Page+title%]]
8987 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
8988 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
8989 [[%33%45]] [[%33%45+]]
8990 !! result
8991 <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>
8992 <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>
8993 <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>
8994 <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>
8995 </p>
8996 !! end
8997
8998 !! test
8999 Special characters in embedded file links (bug 27679)
9000 !! input
9001 [[File:Contains & ampersand.jpg]]
9002 [[File:Does not exist.jpg|Title with & ampersand]]
9003 !! result
9004 <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>
9005 <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>
9006 </p>
9007 !! end
9008
9009
9010 !! test
9011 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
9012 !! input
9013 Text&apos;s been normalized?
9014 !! result
9015 <p>Text&#39;s been normalized?
9016 </p>
9017 !! end
9018
9019 !! test
9020 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
9021 !! input
9022 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
9023 !! result
9024 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
9025 </p>
9026 !! end
9027
9028 !! test
9029 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
9030 !! input
9031 [http://www.example.org/ ideograms]
9032 !! result
9033 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
9034 </p>
9035 !! end
9036
9037 !! test
9038 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
9039 !! input
9040 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
9041 !! result
9042 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
9043 </p>
9044 !! end
9045
9046 !! article
9047 Mediawiki:loop1
9048 !! text
9049 {{Identical|A}}
9050 !! endarticle
9051
9052 !! article
9053 Mediawiki:loop2
9054 !! text
9055 {{Identical|B}}
9056 !! endarticle
9057
9058 !! article
9059 Template:Identical
9060 !! text
9061 {{int:loop1}}
9062 {{int:loop2}}
9063 !! endarticle
9064
9065 !! test
9066 Bug 31098 Template which includes system messages which includes the template
9067 !! input
9068 {{Identical}}
9069 !! result
9070 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
9071 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
9072 </p>
9073 !! end
9074
9075 !! test
9076 Deprecated presentational attributes are converted to css
9077 !! input
9078 {|
9079 | valign=top align=left width=100 height=25% | Asdf
9080 |}
9081 <ul type="disc"></ul>
9082 !! result
9083 <table>
9084 <tr>
9085 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
9086 </td></tr></table>
9087 <ul style="list-style-type: disc;"></ul>
9088
9089 !! end
9090
9091 !! test
9092 Bug31490 Turkish: ucfirst 'blah'
9093 !! options
9094 language=tr
9095 !! input
9096 {{ucfirst:blah}}
9097 !! result
9098 <p>Blah
9099 </p>
9100 !! end
9101
9102 !! test
9103 Bug31490 Turkish: ucfirst 'ix'
9104 !! options
9105 language=tr
9106 !! input
9107 {{ucfirst:ix}}
9108 !! result
9109 <p>İx
9110 </p>
9111 !! end
9112
9113 !! test
9114 Bug31490 Turkish: lcfirst 'BLAH'
9115 !! options
9116 language=tr
9117 !! input
9118 {{lcfirst:BLAH}}
9119 !! result
9120 <p>bLAH
9121 </p>
9122 !! end
9123
9124 !! test
9125 Bug31490 Turkish: ucfırst (with a dotless i)
9126 !! options
9127 language=tr
9128 !! input
9129 {{ucfırst:blah}}
9130 !! result
9131 <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>
9132 </p>
9133 !! end
9134
9135 !! test
9136 Bug31490 ucfırst (with a dotless i) with English language
9137 !! options
9138 language=en
9139 !! input
9140 {{ucfırst:blah}}
9141 !! result
9142 <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>
9143 </p>
9144 !! end
9145
9146 !! test
9147 Bug 26375: TOC with italics
9148 !! options
9149 title=[[Main Page]]
9150 !! input
9151 __TOC__
9152 == ''Lost'' episodes ==
9153 !! result
9154 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9155 <ul>
9156 <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>
9157 </ul>
9158 </td></tr></table>
9159 <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>
9160
9161 !! end
9162
9163 !! test
9164 Bug 26375: TOC with bold
9165 !! options
9166 title=[[Main Page]]
9167 !! input
9168 __TOC__
9169 == '''should be bold''' then normal text ==
9170 !! result
9171 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9172 <ul>
9173 <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>
9174 </ul>
9175 </td></tr></table>
9176 <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>
9177
9178 !! end
9179
9180 !! test
9181 Bug 33845: Headings become cursive in TOC when they contain an image
9182 !! options
9183 title=[[Main Page]]
9184 !! input
9185 __TOC__
9186 == Image [[Image:foobar.jpg]] ==
9187 !! result
9188 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9189 <ul>
9190 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
9191 </ul>
9192 </td></tr></table>
9193 <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>
9194
9195 !! end
9196
9197 !! test
9198 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
9199 !! options
9200 title=[[Main Page]]
9201 !! input
9202 __TOC__
9203 == <blockquote>Quote</blockquote> ==
9204 !! result
9205 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9206 <ul>
9207 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
9208 </ul>
9209 </td></tr></table>
9210 <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>
9211
9212 !! end
9213
9214 !! test
9215 Unclosed tags in TOC
9216 !! options
9217 title=[[Main Page]]
9218 !! input
9219 __TOC__
9220 == Proof: 2 < 3 ==
9221 <small>Hanc marginis exiguitas non caperet.</small>
9222 QED
9223 !! result
9224 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9225 <ul>
9226 <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>
9227 </ul>
9228 </td></tr></table>
9229 <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>
9230 <p><small>Hanc marginis exiguitas non caperet.</small>
9231 QED
9232 </p>
9233 !! end
9234
9235 !! test
9236 Multiple tags in TOC
9237 !! input
9238 __TOC__
9239 == <i>Foo</i> <b>Bar</b> ==
9240
9241 == <i>Foo</i> <blockquote>Bar</blockquote> ==
9242 !! result
9243 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9244 <ul>
9245 <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>
9246 <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>
9247 </ul>
9248 </td></tr></table>
9249 <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>
9250 <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>
9251
9252 !! end
9253
9254 !! test
9255 Tags with parameters in TOC
9256 !! input
9257 __TOC__
9258 == <sup class="in-h2">Hello</sup> ==
9259
9260 == <sup class="a > b">Evilbye</sup> ==
9261 !! result
9262 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9263 <ul>
9264 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
9265 <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>
9266 </ul>
9267 </td></tr></table>
9268 <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>
9269 <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>
9270
9271 !! end
9272
9273 !! article
9274 MediaWiki:Bug32057
9275 !! text
9276 == {{int:headline_sample}} ==
9277 !! endarticle
9278
9279 !! test
9280 Bug 32057: Title needed when expanding <h> nodes.
9281 !! options
9282 title=[[Main Page]]
9283 !! input
9284 {{int:Bug32057}}
9285 !! result
9286 <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>
9287
9288 !! end
9289
9290 !! test
9291 Strip marker in urlencode
9292 !! input
9293 {{urlencode:x<nowiki/>y}}
9294 {{urlencode:x<nowiki/>y|wiki}}
9295 {{urlencode:x<nowiki/>y|path}}
9296 !! result
9297 <p>xy
9298 xy
9299 xy
9300 </p>
9301 !! end
9302
9303 !! test
9304 Strip marker in lc
9305 !! input
9306 {{lc:x<nowiki/>y}}
9307 !! result
9308 <p>xy
9309 </p>
9310 !! end
9311
9312 !! test
9313 Strip marker in uc
9314 !! input
9315 {{uc:x<nowiki/>y}}
9316 !! result
9317 <p>XY
9318 </p>
9319 !! end
9320
9321 !! test
9322 Strip marker in formatNum
9323 !! input
9324 {{formatnum:1<nowiki/>2}}
9325 {{formatnum:1<nowiki/>2|R}}
9326 !! result
9327 <p>12
9328 12
9329 </p>
9330 !! end
9331
9332 !! test
9333 Strip marker in grammar
9334 !! options
9335 language=fi
9336 !! input
9337 {{grammar:elative|foo<nowiki/>bar}}
9338 !! result
9339 <p>foobarista
9340 </p>
9341 !! end
9342
9343 !! test
9344 Strip marker in padleft
9345 !! input
9346 {{padleft:|2|x<nowiki/>y}}
9347 !! result
9348 <p>xy
9349 </p>
9350 !! end
9351
9352 !! test
9353 Strip marker in padright
9354 !! input
9355 {{padright:|2|x<nowiki/>y}}
9356 !! result
9357 <p>xy
9358 </p>
9359 !! end
9360
9361 !! test
9362 Strip marker in anchorencode
9363 !! input
9364 {{anchorencode:x<nowiki/>y}}
9365 !! result
9366 <p>xy
9367 </p>
9368 !! end
9369
9370 !! test
9371 nowiki inside link inside heading (bug 18295)
9372 !! input
9373 ==[[foo|x<nowiki>y</nowiki>z]]==
9374 !! result
9375 <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>
9376
9377 !! end
9378
9379 !! test
9380 new support for bdi element (bug 31817)
9381 !! input
9382 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
9383 !! result
9384 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
9385
9386 !!end
9387
9388 !! test
9389 Ignore pipe between table row attributes
9390 !! input
9391 {|
9392 | quux
9393 |- id=foo | style='color: red'
9394 | bar
9395 |}
9396 !! result
9397 <table>
9398 <tr>
9399 <td> quux
9400 </td></tr>
9401 <tr id="foo" style="color: red">
9402 <td> bar
9403 </td></tr></table>
9404
9405 !! end
9406
9407 !!test
9408 Gallery override link with WikiLink (bug 34852)
9409 !! input
9410 <gallery>
9411 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
9412 </gallery>
9413 !! result
9414 <ul class="gallery">
9415 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9416 <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>
9417 <div class="gallerytext">
9418 <p>caption
9419 </p>
9420 </div>
9421 </div></li>
9422 </ul>
9423
9424 !! end
9425
9426 !!test
9427 Gallery override link with absolute external link (bug 34852)
9428 !! input
9429 <gallery>
9430 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
9431 </gallery>
9432 !! result
9433 <ul class="gallery">
9434 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9435 <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>
9436 <div class="gallerytext">
9437 <p>caption
9438 </p>
9439 </div>
9440 </div></li>
9441 </ul>
9442
9443 !! end
9444
9445 !!test
9446 Gallery override link with malicious javascript (bug 34852)
9447 !! input
9448 <gallery>
9449 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
9450 </gallery>
9451 !! result
9452 <ul class="gallery">
9453 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9454 <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>
9455 <div class="gallerytext">
9456 <p>caption
9457 </p>
9458 </div>
9459 </div></li>
9460 </ul>
9461
9462 !! end
9463
9464 !!test
9465 Language parser function
9466 !! input
9467 {{#language:ar}}
9468 !! result
9469 <p>العربية
9470 </p>
9471 !! end
9472
9473 !!test
9474 Padleft and padright as substr
9475 !! input
9476 {{padleft:|3|abcde}}
9477 {{padright:|3|abcde}}
9478 !! result
9479 <p>abc
9480 abc
9481 </p>
9482 !! end
9483
9484 TODO:
9485 more images
9486 more tables
9487 math
9488 character entities
9489 and much more
9490 Try for 100% code coverage