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