Merge "Bug 36785 Special:Shortpages lists only NS_MAIN pages. (pages from all $wgCont...
[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 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6068
6069 !! end
6070
6071 !! test
6072 Special page transclusion twice (bug 5021)
6073 !! options
6074 !! input
6075 {{Special:Prefixindex/Xyzzyx}}
6076 {{Special:Prefixindex/Xyzzyx}}
6077 !! result
6078 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6079 <table border="0" id="mw-prefixindex-list-table"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
6080
6081 !! end
6082
6083 !! test
6084 Transclusion of default MediaWiki message
6085 !! input
6086 {{MediaWiki:Mainpage}}
6087 !!result
6088 <p>Main Page
6089 </p>
6090 !! end
6091
6092 !! test
6093 Transclusion of nonexistent MediaWiki message
6094 !! input
6095 {{MediaWiki:Mainpagexxx}}
6096 !!result
6097 <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>
6098 </p>
6099 !! end
6100
6101 !! test
6102 Transclusion of MediaWiki message with underscore
6103 !! input
6104 {{MediaWiki:history_short}}
6105 !! result
6106 <p>History
6107 </p>
6108 !! end
6109
6110 !! test
6111 Transclusion of MediaWiki message with space
6112 !! input
6113 {{MediaWiki:history short}}
6114 !! result
6115 <p>History
6116 </p>
6117 !! end
6118
6119 !! test
6120 Invalid header with following text
6121 !! input
6122 = x = y
6123 !! result
6124 <p>= x = y
6125 </p>
6126 !! end
6127
6128
6129 !! test
6130 Section extraction test (section 0)
6131 !! options
6132 section=0
6133 !! input
6134 start
6135 ==a==
6136 ===aa===
6137 ====aaa====
6138 ==b==
6139 ===ba===
6140 ===bb===
6141 ====bba====
6142 ===bc===
6143 ==c==
6144 ===ca===
6145 !! result
6146 start
6147 !! end
6148
6149 !! test
6150 Section extraction test (section 1)
6151 !! options
6152 section=1
6153 !! input
6154 start
6155 ==a==
6156 ===aa===
6157 ====aaa====
6158 ==b==
6159 ===ba===
6160 ===bb===
6161 ====bba====
6162 ===bc===
6163 ==c==
6164 ===ca===
6165 !! result
6166 ==a==
6167 ===aa===
6168 ====aaa====
6169 !! end
6170
6171 !! test
6172 Section extraction test (section 2)
6173 !! options
6174 section=2
6175 !! input
6176 start
6177 ==a==
6178 ===aa===
6179 ====aaa====
6180 ==b==
6181 ===ba===
6182 ===bb===
6183 ====bba====
6184 ===bc===
6185 ==c==
6186 ===ca===
6187 !! result
6188 ===aa===
6189 ====aaa====
6190 !! end
6191
6192 !! test
6193 Section extraction test (section 3)
6194 !! options
6195 section=3
6196 !! input
6197 start
6198 ==a==
6199 ===aa===
6200 ====aaa====
6201 ==b==
6202 ===ba===
6203 ===bb===
6204 ====bba====
6205 ===bc===
6206 ==c==
6207 ===ca===
6208 !! result
6209 ====aaa====
6210 !! end
6211
6212 !! test
6213 Section extraction test (section 4)
6214 !! options
6215 section=4
6216 !! input
6217 start
6218 ==a==
6219 ===aa===
6220 ====aaa====
6221 ==b==
6222 ===ba===
6223 ===bb===
6224 ====bba====
6225 ===bc===
6226 ==c==
6227 ===ca===
6228 !! result
6229 ==b==
6230 ===ba===
6231 ===bb===
6232 ====bba====
6233 ===bc===
6234 !! end
6235
6236 !! test
6237 Section extraction test (section 5)
6238 !! options
6239 section=5
6240 !! input
6241 start
6242 ==a==
6243 ===aa===
6244 ====aaa====
6245 ==b==
6246 ===ba===
6247 ===bb===
6248 ====bba====
6249 ===bc===
6250 ==c==
6251 ===ca===
6252 !! result
6253 ===ba===
6254 !! end
6255
6256 !! test
6257 Section extraction test (section 6)
6258 !! options
6259 section=6
6260 !! input
6261 start
6262 ==a==
6263 ===aa===
6264 ====aaa====
6265 ==b==
6266 ===ba===
6267 ===bb===
6268 ====bba====
6269 ===bc===
6270 ==c==
6271 ===ca===
6272 !! result
6273 ===bb===
6274 ====bba====
6275 !! end
6276
6277 !! test
6278 Section extraction test (section 7)
6279 !! options
6280 section=7
6281 !! input
6282 start
6283 ==a==
6284 ===aa===
6285 ====aaa====
6286 ==b==
6287 ===ba===
6288 ===bb===
6289 ====bba====
6290 ===bc===
6291 ==c==
6292 ===ca===
6293 !! result
6294 ====bba====
6295 !! end
6296
6297 !! test
6298 Section extraction test (section 8)
6299 !! options
6300 section=8
6301 !! input
6302 start
6303 ==a==
6304 ===aa===
6305 ====aaa====
6306 ==b==
6307 ===ba===
6308 ===bb===
6309 ====bba====
6310 ===bc===
6311 ==c==
6312 ===ca===
6313 !! result
6314 ===bc===
6315 !! end
6316
6317 !! test
6318 Section extraction test (section 9)
6319 !! options
6320 section=9
6321 !! input
6322 start
6323 ==a==
6324 ===aa===
6325 ====aaa====
6326 ==b==
6327 ===ba===
6328 ===bb===
6329 ====bba====
6330 ===bc===
6331 ==c==
6332 ===ca===
6333 !! result
6334 ==c==
6335 ===ca===
6336 !! end
6337
6338 !! test
6339 Section extraction test (section 10)
6340 !! options
6341 section=10
6342 !! input
6343 start
6344 ==a==
6345 ===aa===
6346 ====aaa====
6347 ==b==
6348 ===ba===
6349 ===bb===
6350 ====bba====
6351 ===bc===
6352 ==c==
6353 ===ca===
6354 !! result
6355 ===ca===
6356 !! end
6357
6358 !! test
6359 Section extraction test (nonexistent section 11)
6360 !! options
6361 section=11
6362 !! input
6363 start
6364 ==a==
6365 ===aa===
6366 ====aaa====
6367 ==b==
6368 ===ba===
6369 ===bb===
6370 ====bba====
6371 ===bc===
6372 ==c==
6373 ===ca===
6374 !! result
6375 !! end
6376
6377 !! test
6378 Section extraction test with bogus heading (section 1)
6379 !! options
6380 section=1
6381 !! input
6382 ==a==
6383 ==bogus== not a legal section
6384 ==b==
6385 !! result
6386 ==a==
6387 ==bogus== not a legal section
6388 !! end
6389
6390 !! test
6391 Section extraction test with bogus heading (section 2)
6392 !! options
6393 section=2
6394 !! input
6395 ==a==
6396 ==bogus== not a legal section
6397 ==b==
6398 !! result
6399 ==b==
6400 !! end
6401
6402 !! test
6403 Section extraction test with comment after heading (section 1)
6404 !! options
6405 section=1
6406 !! input
6407 ==a==
6408 ==b== <!-- -->
6409 ==c==
6410 !! result
6411 ==a==
6412 !! end
6413
6414 !! test
6415 Section extraction test with comment after heading (section 2)
6416 !! options
6417 section=2
6418 !! input
6419 ==a==
6420 ==b== <!-- -->
6421 ==c==
6422 !! result
6423 ==b== <!-- -->
6424 !! end
6425
6426 !! test
6427 Section extraction test with bogus <nowiki> heading (section 1)
6428 !! options
6429 section=1
6430 !! input
6431 ==a==
6432 ==bogus== <nowiki>not a legal section</nowiki>
6433 ==b==
6434 !! result
6435 ==a==
6436 ==bogus== <nowiki>not a legal section</nowiki>
6437 !! end
6438
6439 !! test
6440 Section extraction test with bogus <nowiki> heading (section 2)
6441 !! options
6442 section=2
6443 !! input
6444 ==a==
6445 ==bogus== <nowiki>not a legal section</nowiki>
6446 ==b==
6447 !! result
6448 ==b==
6449 !! end
6450
6451
6452 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
6453 # instead of respecting commented sections
6454 !! test
6455 Section extraction prefixed by comment (section 1)
6456 !! options
6457 section=1
6458 !! input
6459 <!-- -->==sec1==
6460 ==sec2==
6461 !!result
6462 ==sec2==
6463 !!end
6464
6465 !! test
6466 Section extraction prefixed by comment (section 2)
6467 !! options
6468 section=2
6469 !! input
6470 <!-- -->==sec1==
6471 ==sec2==
6472 !!result
6473
6474 !!end
6475
6476
6477 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
6478 # instead of respecting HTML-style headings
6479 !! test
6480 Section extraction, mixed wiki and html (section 1)
6481 !! options
6482 section=1
6483 !! input
6484 <h2>unmarked</h2>
6485 unmarked
6486 ==1==
6487 one
6488 ==2==
6489 two
6490 !! result
6491 ==1==
6492 one
6493 !! end
6494
6495 !! test
6496 Section extraction, mixed wiki and html (section 2)
6497 !! options
6498 section=2
6499 !! input
6500 <h2>unmarked</h2>
6501 unmarked
6502 ==1==
6503 one
6504 ==2==
6505 two
6506 !! result
6507 ==2==
6508 two
6509 !! end
6510
6511
6512 # Formerly testing for bug 3342
6513 !! test
6514 Section extraction, heading surrounded by <noinclude>
6515 !! options
6516 section=1
6517 !! input
6518 <noinclude>==unmarked==</noinclude>
6519 ==marked==
6520 !! result
6521 ==marked==
6522 !!end
6523
6524 # Test behaviour of bug 19910
6525 !! test
6526 Sectiion with all-equals
6527 !! options
6528 section=2
6529 !! input
6530 ===
6531 The line above must have a trailing space
6532 === <!--
6533 --> <!-- -->
6534 But just in case it doesn't...
6535 !! result
6536 === <!--
6537 --> <!-- -->
6538 But just in case it doesn't...
6539 !! end
6540
6541 !! test
6542 Section replacement test (section 0)
6543 !! options
6544 replace=0,"xxx"
6545 !! input
6546 start
6547 ==a==
6548 ===aa===
6549 ====aaa====
6550 ==b==
6551 ===ba===
6552 ===bb===
6553 ====bba====
6554 ===bc===
6555 ==c==
6556 ===ca===
6557 !! result
6558 xxx
6559
6560 ==a==
6561 ===aa===
6562 ====aaa====
6563 ==b==
6564 ===ba===
6565 ===bb===
6566 ====bba====
6567 ===bc===
6568 ==c==
6569 ===ca===
6570 !! end
6571
6572 !! test
6573 Section replacement test (section 1)
6574 !! options
6575 replace=1,"xxx"
6576 !! input
6577 start
6578 ==a==
6579 ===aa===
6580 ====aaa====
6581 ==b==
6582 ===ba===
6583 ===bb===
6584 ====bba====
6585 ===bc===
6586 ==c==
6587 ===ca===
6588 !! result
6589 start
6590 xxx
6591
6592 ==b==
6593 ===ba===
6594 ===bb===
6595 ====bba====
6596 ===bc===
6597 ==c==
6598 ===ca===
6599 !! end
6600
6601 !! test
6602 Section replacement test (section 2)
6603 !! options
6604 replace=2,"xxx"
6605 !! input
6606 start
6607 ==a==
6608 ===aa===
6609 ====aaa====
6610 ==b==
6611 ===ba===
6612 ===bb===
6613 ====bba====
6614 ===bc===
6615 ==c==
6616 ===ca===
6617 !! result
6618 start
6619 ==a==
6620 xxx
6621
6622 ==b==
6623 ===ba===
6624 ===bb===
6625 ====bba====
6626 ===bc===
6627 ==c==
6628 ===ca===
6629 !! end
6630
6631 !! test
6632 Section replacement test (section 3)
6633 !! options
6634 replace=3,"xxx"
6635 !! input
6636 start
6637 ==a==
6638 ===aa===
6639 ====aaa====
6640 ==b==
6641 ===ba===
6642 ===bb===
6643 ====bba====
6644 ===bc===
6645 ==c==
6646 ===ca===
6647 !! result
6648 start
6649 ==a==
6650 ===aa===
6651 xxx
6652
6653 ==b==
6654 ===ba===
6655 ===bb===
6656 ====bba====
6657 ===bc===
6658 ==c==
6659 ===ca===
6660 !! end
6661
6662 !! test
6663 Section replacement test (section 4)
6664 !! options
6665 replace=4,"xxx"
6666 !! input
6667 start
6668 ==a==
6669 ===aa===
6670 ====aaa====
6671 ==b==
6672 ===ba===
6673 ===bb===
6674 ====bba====
6675 ===bc===
6676 ==c==
6677 ===ca===
6678 !! result
6679 start
6680 ==a==
6681 ===aa===
6682 ====aaa====
6683 xxx
6684
6685 ==c==
6686 ===ca===
6687 !! end
6688
6689 !! test
6690 Section replacement test (section 5)
6691 !! options
6692 replace=5,"xxx"
6693 !! input
6694 start
6695 ==a==
6696 ===aa===
6697 ====aaa====
6698 ==b==
6699 ===ba===
6700 ===bb===
6701 ====bba====
6702 ===bc===
6703 ==c==
6704 ===ca===
6705 !! result
6706 start
6707 ==a==
6708 ===aa===
6709 ====aaa====
6710 ==b==
6711 xxx
6712
6713 ===bb===
6714 ====bba====
6715 ===bc===
6716 ==c==
6717 ===ca===
6718 !! end
6719
6720 !! test
6721 Section replacement test (section 6)
6722 !! options
6723 replace=6,"xxx"
6724 !! input
6725 start
6726 ==a==
6727 ===aa===
6728 ====aaa====
6729 ==b==
6730 ===ba===
6731 ===bb===
6732 ====bba====
6733 ===bc===
6734 ==c==
6735 ===ca===
6736 !! result
6737 start
6738 ==a==
6739 ===aa===
6740 ====aaa====
6741 ==b==
6742 ===ba===
6743 xxx
6744
6745 ===bc===
6746 ==c==
6747 ===ca===
6748 !! end
6749
6750 !! test
6751 Section replacement test (section 7)
6752 !! options
6753 replace=7,"xxx"
6754 !! input
6755 start
6756 ==a==
6757 ===aa===
6758 ====aaa====
6759 ==b==
6760 ===ba===
6761 ===bb===
6762 ====bba====
6763 ===bc===
6764 ==c==
6765 ===ca===
6766 !! result
6767 start
6768 ==a==
6769 ===aa===
6770 ====aaa====
6771 ==b==
6772 ===ba===
6773 ===bb===
6774 xxx
6775
6776 ===bc===
6777 ==c==
6778 ===ca===
6779 !! end
6780
6781 !! test
6782 Section replacement test (section 8)
6783 !! options
6784 replace=8,"xxx"
6785 !! input
6786 start
6787 ==a==
6788 ===aa===
6789 ====aaa====
6790 ==b==
6791 ===ba===
6792 ===bb===
6793 ====bba====
6794 ===bc===
6795 ==c==
6796 ===ca===
6797 !! result
6798 start
6799 ==a==
6800 ===aa===
6801 ====aaa====
6802 ==b==
6803 ===ba===
6804 ===bb===
6805 ====bba====
6806 xxx
6807
6808 ==c==
6809 ===ca===
6810 !!end
6811
6812 !! test
6813 Section replacement test (section 9)
6814 !! options
6815 replace=9,"xxx"
6816 !! input
6817 start
6818 ==a==
6819 ===aa===
6820 ====aaa====
6821 ==b==
6822 ===ba===
6823 ===bb===
6824 ====bba====
6825 ===bc===
6826 ==c==
6827 ===ca===
6828 !! result
6829 start
6830 ==a==
6831 ===aa===
6832 ====aaa====
6833 ==b==
6834 ===ba===
6835 ===bb===
6836 ====bba====
6837 ===bc===
6838 xxx
6839 !! end
6840
6841 !! test
6842 Section replacement test (section 10)
6843 !! options
6844 replace=10,"xxx"
6845 !! input
6846 start
6847 ==a==
6848 ===aa===
6849 ====aaa====
6850 ==b==
6851 ===ba===
6852 ===bb===
6853 ====bba====
6854 ===bc===
6855 ==c==
6856 ===ca===
6857 !! result
6858 start
6859 ==a==
6860 ===aa===
6861 ====aaa====
6862 ==b==
6863 ===ba===
6864 ===bb===
6865 ====bba====
6866 ===bc===
6867 ==c==
6868 xxx
6869 !! end
6870
6871 !! test
6872 Section replacement test with initial whitespace (bug 13728)
6873 !! options
6874 replace=2,"xxx"
6875 !! input
6876 Preformatted initial line
6877 ==a==
6878 ===a===
6879 !! result
6880 Preformatted initial line
6881 ==a==
6882 xxx
6883 !! end
6884
6885
6886 !! test
6887 Section extraction, heading followed by pre with 20 spaces (bug 6398)
6888 !! options
6889 section=1
6890 !! input
6891 ==a==
6892 a
6893 !! result
6894 ==a==
6895 a
6896 !! end
6897
6898 !! test
6899 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
6900 !! options
6901 section=1
6902 !! input
6903 ==a==
6904 a
6905 !! result
6906 ==a==
6907 a
6908 !! end
6909
6910
6911 !! test
6912 Section extraction, <pre> around bogus header (bug 10309)
6913 !! options
6914 noxml section=2
6915 !! input
6916 == Section One ==
6917 <pre>
6918 =======
6919 </pre>
6920
6921 == Section Two ==
6922 stuff
6923 !! result
6924 == Section Two ==
6925 stuff
6926 !! end
6927
6928 !! test
6929 Section replacement, <pre> around bogus header (bug 10309)
6930 !! options
6931 noxml replace=2,"xxx"
6932 !! input
6933 == Section One ==
6934 <pre>
6935 =======
6936 </pre>
6937
6938 == Section Two ==
6939 stuff
6940 !! result
6941 == Section One ==
6942 <pre>
6943 =======
6944 </pre>
6945
6946 xxx
6947 !! end
6948
6949
6950
6951 !! test
6952 Handling of &#x0A; in URLs
6953 !! input
6954 **irc://&#x0A;a
6955 !! result
6956 <ul><li><ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a>
6957 </li></ul>
6958 </li></ul>
6959
6960 !!end
6961
6962 !! test
6963 5 quotes, code coverage +1 line
6964 !! input
6965 '''''
6966 !! result
6967 !! end
6968
6969 !! test
6970 Special:Search page linking.
6971 !! input
6972 {{Special:search}}
6973 !! result
6974 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6975 </p>
6976 !! end
6977
6978 !! test
6979 Say the magic word
6980 !! input
6981 * {{PAGENAME}}
6982 * {{BASEPAGENAME}}
6983 * {{SUBPAGENAME}}
6984 * {{SUBPAGENAMEE}}
6985 * {{BASEPAGENAME}}
6986 * {{BASEPAGENAMEE}}
6987 * {{TALKPAGENAME}}
6988 * {{TALKPAGENAMEE}}
6989 * {{SUBJECTPAGENAME}}
6990 * {{SUBJECTPAGENAMEE}}
6991 * {{NAMESPACEE}}
6992 * {{NAMESPACE}}
6993 * {{TALKSPACE}}
6994 * {{TALKSPACEE}}
6995 * {{SUBJECTSPACE}}
6996 * {{SUBJECTSPACEE}}
6997 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6998 !! result
6999 <ul><li> Parser test
7000 </li><li> Parser test
7001 </li><li> Parser test
7002 </li><li> Parser_test
7003 </li><li> Parser test
7004 </li><li> Parser_test
7005 </li><li> Talk:Parser test
7006 </li><li> Talk:Parser_test
7007 </li><li> Parser test
7008 </li><li> Parser_test
7009 </li><li>
7010 </li><li>
7011 </li><li> Talk
7012 </li><li> Talk
7013 </li><li>
7014 </li><li>
7015 </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>
7016 </li></ul>
7017
7018 !! end
7019 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
7020
7021 !! test
7022 Gallery
7023 !! input
7024 <gallery>
7025 image1.png |
7026 image2.gif|||||
7027
7028 image3|
7029 image4 |300px| centre
7030 image5.svg| http://///////
7031 [[x|xx]]]]
7032 * image6
7033 </gallery>
7034 !! result
7035 <ul class="gallery">
7036 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7037 <div style="height: 150px;">Image1.png</div>
7038 <div class="gallerytext">
7039 </div>
7040 </div></li>
7041 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7042 <div style="height: 150px;">Image2.gif</div>
7043 <div class="gallerytext">
7044 <p>||||
7045 </p>
7046 </div>
7047 </div></li>
7048 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7049 <div style="height: 150px;">Image3</div>
7050 <div class="gallerytext">
7051 </div>
7052 </div></li>
7053 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7054 <div style="height: 150px;">Image4</div>
7055 <div class="gallerytext">
7056 <p>300px| centre
7057 </p>
7058 </div>
7059 </div></li>
7060 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7061 <div style="height: 150px;">Image5.svg</div>
7062 <div class="gallerytext">
7063 <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
7064 </p>
7065 </div>
7066 </div></li>
7067 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7068 <div style="height: 150px;">* image6</div>
7069 <div class="gallerytext">
7070 </div>
7071 </div></li>
7072 </ul>
7073
7074 !! end
7075
7076 !! test
7077 Gallery (with options)
7078 !! input
7079 <gallery widths='70px' heights='40px' perrow='2' caption='Foo [[Main Page]]' >
7080 File:Nonexistant.jpg|caption
7081 File:Nonexistant.jpg
7082 image:foobar.jpg|some '''caption''' [[Main Page]]
7083 image:foobar.jpg
7084 image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
7085 </gallery>
7086 !! result
7087 <ul class="gallery" style="max-width: 226px;_width: 226px;">
7088 <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
7089 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7090 <div style="height: 70px;">Nonexistant.jpg</div>
7091 <div class="gallerytext">
7092 <p>caption
7093 </p>
7094 </div>
7095 </div></li>
7096 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7097 <div style="height: 70px;">Nonexistant.jpg</div>
7098 <div class="gallerytext">
7099 </div>
7100 </div></li>
7101 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7102 <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>
7103 <div class="gallerytext">
7104 <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7105 </p>
7106 </div>
7107 </div></li>
7108 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7109 <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>
7110 <div class="gallerytext">
7111 </div>
7112 </div></li>
7113 <li class="gallerybox" style="width: 105px"><div style="width: 105px">
7114 <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>
7115 <div class="gallerytext">
7116 <p>Blabla|blabla.
7117 </p>
7118 </div>
7119 </div></li>
7120 </ul>
7121
7122 !! end
7123
7124 !! test
7125 Gallery with wikitext inside caption
7126 !! input
7127 <gallery>
7128 File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=inneralt]]|alt=galleryalt
7129 File:foobar.jpg|{{Test|unamedParam|alt=param}}|alt=galleryalt
7130 </gallery>
7131 !! result
7132 <ul class="gallery">
7133 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7134 <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>
7135 <div class="gallerytext">
7136 <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>
7137 </p>
7138 </div>
7139 </div></li>
7140 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7141 <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>
7142 <div class="gallerytext">
7143 <p>This is a test template
7144 </p>
7145 </div>
7146 </div></li>
7147 </ul>
7148
7149 !! end
7150
7151 !! test
7152 gallery (with showfilename option)
7153 !! input
7154 <gallery showfilename>
7155 File:Nonexistant.jpg|caption
7156 File:Nonexistant.jpg
7157 image:foobar.jpg|some '''caption''' [[Main Page]]
7158 File:Foobar.jpg
7159 </gallery>
7160 !! result
7161 <ul class="gallery">
7162 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7163 <div style="height: 150px;">Nonexistant.jpg</div>
7164 <div class="gallerytext">
7165 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7166 caption
7167 </p>
7168 </div>
7169 </div></li>
7170 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7171 <div style="height: 150px;">Nonexistant.jpg</div>
7172 <div class="gallerytext">
7173 <p><a href="/wiki/File:Nonexistant.jpg" title="File:Nonexistant.jpg">Nonexistant.jpg</a><br />
7174 </p>
7175 </div>
7176 </div></li>
7177 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7178 <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>
7179 <div class="gallerytext">
7180 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7181 some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7182 </p>
7183 </div>
7184 </div></li>
7185 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7186 <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>
7187 <div class="gallerytext">
7188 <p><a href="/wiki/File:Foobar.jpg" title="File:Foobar.jpg">Foobar.jpg</a><br />
7189 </p>
7190 </div>
7191 </div></li>
7192 </ul>
7193
7194 !! end
7195
7196 !! test
7197 Gallery (with namespace-less filenames)
7198 !! input
7199 <gallery>
7200 File:Nonexistant.jpg
7201 Nonexistant.jpg
7202 image:foobar.jpg
7203 foobar.jpg
7204 </gallery>
7205 !! result
7206 <ul class="gallery">
7207 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7208 <div style="height: 150px;">Nonexistant.jpg</div>
7209 <div class="gallerytext">
7210 </div>
7211 </div></li>
7212 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7213 <div style="height: 150px;">Nonexistant.jpg</div>
7214 <div class="gallerytext">
7215 </div>
7216 </div></li>
7217 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7218 <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>
7219 <div class="gallerytext">
7220 </div>
7221 </div></li>
7222 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
7223 <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>
7224 <div class="gallerytext">
7225 </div>
7226 </div></li>
7227 </ul>
7228
7229 !! end
7230
7231 !! test
7232 HTML Hex character encoding (spells the word "JavaScript")
7233 !! input
7234 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
7235 !! result
7236 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
7237 </p>
7238 !! end
7239
7240 !! test
7241 HTML Hex character encoding bogus encoding (bug 26437 regression check)
7242 !! input
7243 &#xsee;&#XSEE;
7244 !! result
7245 <p>&amp;#xsee;&amp;#XSEE;
7246 </p>
7247 !! end
7248
7249 !! test
7250 HTML Hex character encoding mixed case
7251 !! input
7252 &#xEE;&#Xee;
7253 !! result
7254 <p>&#xee;&#xee;
7255 </p>
7256 !! end
7257
7258 !! test
7259 __FORCETOC__ override
7260 !! input
7261 __NEWSECTIONLINK__
7262 __FORCETOC__
7263 !! result
7264 <p><br />
7265 </p>
7266 !! end
7267
7268 !! test
7269 ISBN code coverage
7270 !! input
7271 ISBN 978-0-1234-56&#x20;789
7272 !! result
7273 <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
7274 </p>
7275 !! end
7276
7277 !! test
7278 ISBN followed by 5 spaces
7279 !! input
7280 ISBN
7281 !! result
7282 <p>ISBN
7283 </p>
7284 !! end
7285
7286 !! test
7287 Double ISBN
7288 !! input
7289 ISBN ISBN 1234567890
7290 !! result
7291 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7292 </p>
7293 !! end
7294
7295 !! test
7296 Bug 22905: <abbr> followed by ISBN followed by </a>
7297 !! input
7298 <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
7299 !! result
7300 <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>
7301 </p>
7302 !! end
7303
7304 !! test
7305 Double RFC
7306 !! input
7307 RFC RFC 1234
7308 !! result
7309 <p>RFC <a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc1234">RFC 1234</a>
7310 </p>
7311 !! end
7312
7313 !! test
7314 Double RFC with a wiki link
7315 !! input
7316 RFC [[RFC 1234]]
7317 !! result
7318 <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>
7319 </p>
7320 !! end
7321
7322 !! test
7323 RFC code coverage
7324 !! input
7325 RFC 983&#x20;987
7326 !! result
7327 <p><a class="external mw-magiclink-rfc" href="//tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
7328 </p>
7329 !! end
7330
7331 !! test
7332 Centre-aligned image
7333 !! input
7334 [[Image:foobar.jpg|centre]]
7335 !! result
7336 <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>
7337
7338 !!end
7339
7340 !! test
7341 None-aligned image
7342 !! input
7343 [[Image:foobar.jpg|none]]
7344 !! result
7345 <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>
7346
7347 !!end
7348
7349 !! test
7350 Width + Height sized image (using px) (height is ignored)
7351 !! input
7352 [[Image:foobar.jpg|640x480px]]
7353 !! result
7354 <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>
7355 </p>
7356 !!end
7357
7358 !! test
7359 Width-sized image (using px, no following whitespace)
7360 !! input
7361 [[Image:foobar.jpg|640px]]
7362 !! result
7363 <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>
7364 </p>
7365 !!end
7366
7367 !! test
7368 Width-sized image (using px, with following whitespace - test regression from r39467)
7369 !! input
7370 [[Image:foobar.jpg|640px ]]
7371 !! result
7372 <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>
7373 </p>
7374 !!end
7375
7376 !! test
7377 Width-sized image (using px, with preceding whitespace - test regression from r39467)
7378 !! input
7379 [[Image:foobar.jpg| 640px]]
7380 !! result
7381 <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>
7382 </p>
7383 !!end
7384
7385 !! test
7386 Another italics / bold test
7387 !! input
7388 ''' ''x'
7389 !! result
7390 <pre>'<i> </i>x'
7391 </pre>
7392 !!end
7393
7394 # Note the results may be incorrect, as parserTest output included this:
7395 # XML error: Mismatched tag at byte 6120:
7396 # ...<dd> </dt></dl> </dd...
7397 !! test
7398 dt/dd/dl test
7399 !! options
7400 disabled
7401 !! input
7402 :;;;::
7403 !! result
7404 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
7405 </dd></dl>
7406 </dd></dl>
7407 </dt></dl>
7408 </dt></dl>
7409 </dt></dl>
7410 </dd></dl>
7411
7412 !!end
7413
7414
7415 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
7416 !! test
7417 Images with the "|" character in the comment
7418 !! input
7419 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
7420 !! result
7421 <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>
7422
7423 !!end
7424
7425 !! test
7426 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
7427 !! input
7428 <html><script>alert(1);</script></html>
7429 !! result
7430 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
7431 </p>
7432 !! end
7433
7434 !! test
7435 HTML with raw HTML ($wgRawHtml==true)
7436 !! options
7437 rawhtml
7438 !! input
7439 <html><script>alert(1);</script></html>
7440 !! result
7441 <p><script>alert(1);</script>
7442 </p>
7443 !! end
7444
7445 !! test
7446 Parents of subpages, one level up
7447 !! options
7448 subpage title=[[Subpage test/L1/L2/L3]]
7449 !! input
7450 [[../|L2]]
7451 !! result
7452 <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>
7453 </p>
7454 !! end
7455
7456
7457 !! test
7458 Parents of subpages, one level up, not named
7459 !! options
7460 subpage title=[[Subpage test/L1/L2/L3]]
7461 !! input
7462 [[../]]
7463 !! result
7464 <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>
7465 </p>
7466 !! end
7467
7468
7469
7470 !! test
7471 Parents of subpages, two levels up
7472 !! options
7473 subpage title=[[Subpage test/L1/L2/L3]]
7474 !! input
7475 [[../../|L1]]2
7476
7477 [[../../|L1]]l
7478 !! result
7479 <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
7480 </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>
7481 </p>
7482 !! end
7483
7484 !! test
7485 Parents of subpages, two levels up, without trailing slash or name.
7486 !! options
7487 subpage title=[[Subpage test/L1/L2/L3]]
7488 !! input
7489 [[../..]]
7490 !! result
7491 <p>[[../..]]
7492 </p>
7493 !! end
7494
7495 !! test
7496 Parents of subpages, two levels up, with lots of extra trailing slashes.
7497 !! options
7498 subpage title=[[Subpage test/L1/L2/L3]]
7499 !! input
7500 [[../../////]]
7501 !! result
7502 <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>
7503 </p>
7504 !! end
7505
7506 !! test
7507 Definition list code coverage
7508 !! input
7509 ; title : def
7510 ; title : def
7511 ;title: def
7512 !! result
7513 <dl><dt> title &#160;</dt><dd> def
7514 </dd><dt> title&#160;</dt><dd> def
7515 </dd><dt>title</dt><dd> def
7516 </dd></dl>
7517
7518 !! end
7519
7520 !! test
7521 Don't fall for the self-closing div
7522 !! input
7523 <div>hello world</div/>
7524 !! result
7525 <div>hello world</div>
7526
7527 !! end
7528
7529 !! test
7530 MSGNW magic word
7531 !! input
7532 {{MSGNW:msg}}
7533 !! result
7534 <p>&#91;&#91;:Template:Msg&#93;&#93;
7535 </p>
7536 !! end
7537
7538 !! test
7539 RAW magic word
7540 !! input
7541 {{RAW:QUERTY}}
7542 !! result
7543 <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>
7544 </p>
7545 !! end
7546
7547 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
7548 !! test
7549 Always escape literal '>' in output, not just after '<'
7550 !! input
7551 ><>
7552 !! result
7553 <p>&gt;&lt;&gt;
7554 </p>
7555 !! end
7556
7557 !! test
7558 Template caching
7559 !! input
7560 {{Test}}
7561 {{Test}}
7562 !! result
7563 <p>This is a test template
7564 This is a test template
7565 </p>
7566 !! end
7567
7568
7569 !! article
7570 MediaWiki:Fake
7571 !! text
7572 ==header==
7573 !! endarticle
7574
7575 !! test
7576 Inclusion of !userCanEdit() content
7577 !! input
7578 {{MediaWiki:Fake}}
7579 !! result
7580 <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>
7581
7582 !! end
7583
7584
7585 !! test
7586 Out-of-order TOC heading levels
7587 !! input
7588 ==2==
7589 ======6======
7590 ===3===
7591 =1=
7592 =====5=====
7593 ==2==
7594 !! result
7595 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
7596 <ul>
7597 <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
7598 <ul>
7599 <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
7600 <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
7601 </ul>
7602 </li>
7603 <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
7604 <ul>
7605 <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
7606 <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
7607 </ul>
7608 </li>
7609 </ul>
7610 </td></tr></table>
7611 <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>
7612 <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>
7613 <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>
7614 <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>
7615 <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>
7616 <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>
7617
7618 !! end
7619
7620
7621 !! test
7622 ISBN with a dummy number
7623 !! input
7624 ISBN ---
7625 !! result
7626 <p>ISBN ---
7627 </p>
7628 !! end
7629
7630
7631 !! test
7632 ISBN with space-delimited number
7633 !! input
7634 ISBN 92 9017 032 8
7635 !! result
7636 <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
7637 </p>
7638 !! end
7639
7640
7641 !! test
7642 ISBN with multiple spaces, no number
7643 !! input
7644 ISBN foo
7645 !! result
7646 <p>ISBN foo
7647 </p>
7648 !! end
7649
7650
7651 !! test
7652 ISBN length
7653 !! input
7654 ISBN 123456789
7655
7656 ISBN 1234567890
7657
7658 ISBN 12345678901
7659 !! result
7660 <p>ISBN 123456789
7661 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
7662 </p><p>ISBN 12345678901
7663 </p>
7664 !! end
7665
7666
7667 !! test
7668 ISBN with trailing year (bug 8110)
7669 !! input
7670 ISBN 1-234-56789-0 - 2006
7671
7672 ISBN 1 234 56789 0 - 2006
7673 !! result
7674 <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
7675 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
7676 </p>
7677 !! end
7678
7679
7680 !! test
7681 anchorencode
7682 !! input
7683 {{anchorencode:foo bar©#%n}}
7684 !! result
7685 <p>foo_bar.C2.A9.23.25n
7686 </p>
7687 !! end
7688
7689 !! test
7690 anchorencode trims spaces
7691 !! input
7692 {{anchorencode: __pretty__please__}}
7693 !! result
7694 <p>pretty_please
7695 </p>
7696 !! end
7697
7698 !! test
7699 anchorencode deals with links
7700 !! input
7701 {{anchorencode: [[hello|world]] [[hi]]}}
7702 !! result
7703 <p>world_hi
7704 </p>
7705 !! end
7706
7707 !! test
7708 anchorencode deals with templates
7709 !! input
7710 {{anchorencode: {{Foo}} }}
7711 !! result
7712 <p>FOO
7713 </p>
7714 !! end
7715
7716 !! test
7717 anchorencode encodes like the TOC generator: (bug 18431)
7718 !! input
7719 === _ +:.3A%3A&&amp;]] ===
7720 {{anchorencode: _ +:.3A%3A&&amp;]] }}
7721 __NOEDITSECTION__
7722 !! result
7723 <h3> <span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D"> _ +:.3A%3A&amp;&amp;]] </span></h3>
7724 <p>.2B:.3A.253A.26.26.5D.5D
7725 </p>
7726 !! end
7727
7728 # Expected output in the following test is not necessarily expected (there
7729 # should probably be <p> tags inside the <blockquote> in the output) -- it's
7730 # only testing for well-formedness.
7731 !! test
7732 Bug 6200: blockquotes and paragraph formatting
7733 !! input
7734 <blockquote>
7735 foo
7736 </blockquote>
7737
7738 bar
7739
7740 baz
7741 !! result
7742 <blockquote>
7743 foo
7744 </blockquote>
7745 <p>bar
7746 </p>
7747 <pre>baz
7748 </pre>
7749 !! end
7750
7751 !! test
7752 Bug 8293: Use of center tag ruins paragraph formatting
7753 !! input
7754 <center>
7755 foo
7756 </center>
7757
7758 bar
7759
7760 baz
7761 !! result
7762 <center>
7763 <p>foo
7764 </p>
7765 </center>
7766 <p>bar
7767 </p>
7768 <pre>baz
7769 </pre>
7770 !! end
7771
7772
7773 ###
7774 ### Language variants related tests
7775 ###
7776 !! test
7777 Self-link in language variants
7778 !! options
7779 title=[[Dunav]] language=sr
7780 !! input
7781 Both [[Dunav]] and [[Дунав]] are names for this river.
7782 !! result
7783 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
7784 </p>
7785 !!end
7786
7787
7788 !! test
7789 Link to pages in language variants
7790 !! options
7791 language=sr
7792 !! input
7793 Main Page can be written as [[Маин Паге]]
7794 !! result
7795 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
7796 </p>
7797 !!end
7798
7799
7800 !! test
7801 Multiple links to pages in language variants
7802 !! options
7803 language=sr
7804 !! input
7805 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
7806 !! result
7807 <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>.
7808 </p>
7809 !!end
7810
7811
7812 !! test
7813 Simple template in language variants
7814 !! options
7815 language=sr
7816 !! input
7817 {{тест}}
7818 !! result
7819 <p>This is a test template
7820 </p>
7821 !! end
7822
7823
7824 !! test
7825 Template with explicit namespace in language variants
7826 !! options
7827 language=sr
7828 !! input
7829 {{Template:тест}}
7830 !! result
7831 <p>This is a test template
7832 </p>
7833 !! end
7834
7835
7836 !! test
7837 Basic test for template parameter in language variants
7838 !! options
7839 language=sr
7840 !! input
7841 {{парамтест|param=foo}}
7842 !! result
7843 <p>This is a test template with parameter foo
7844 </p>
7845 !! end
7846
7847
7848 !! test
7849 Simple category in language variants
7850 !! options
7851 language=sr cat
7852 !! input
7853 [[Category:МедиаWики Усер'с Гуиде]]
7854 !! result
7855 <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>
7856 !! end
7857
7858
7859 !! test
7860 Stripping -{}- tags (language variants)
7861 !! options
7862 language=sr
7863 !! input
7864 Latin proverb: -{Ne nuntium necare}-
7865 !! result
7866 <p>Latin proverb: Ne nuntium necare
7867 </p>
7868 !! end
7869
7870
7871 !! test
7872 Prevent conversion with -{}- tags (language variants)
7873 !! options
7874 language=sr variant=sr-ec
7875 !! input
7876 Latinski: -{Ne nuntium necare}-
7877 !! result
7878 <p>Латински: Ne nuntium necare
7879 </p>
7880 !! end
7881
7882
7883 !! test
7884 Prevent conversion of text with -{}- tags (language variants)
7885 !! options
7886 language=sr variant=sr-ec
7887 !! input
7888 Latinski: -{Ne nuntium necare}-
7889 !! result
7890 <p>Латински: Ne nuntium necare
7891 </p>
7892 !! end
7893
7894
7895 !! test
7896 Prevent conversion of links with -{}- tags (language variants)
7897 !! options
7898 language=sr variant=sr-ec
7899 !! input
7900 -{[[Main Page]]}-
7901 !! result
7902 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
7903 </p>
7904 !! end
7905
7906
7907 !! test
7908 -{}- tags within headlines (within html for parserConvert())
7909 !! options
7910 language=sr variant=sr-ec
7911 !! input
7912 == -{Naslov}- ==
7913 !! result
7914 <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>
7915
7916 !! end
7917
7918
7919 !! test
7920 Explicit definition of language variant alternatives
7921 !! options
7922 language=zh variant=zh-tw
7923 !! input
7924 -{zh:China;zh-tw:Taiwan}-, not China
7925 !! result
7926 <p>Taiwan, not China
7927 </p>
7928 !! end
7929
7930
7931 !! test
7932 Explicit session-wise language variant mapping (A flag and - flag)
7933 !! options
7934 language=zh variant=zh-tw
7935 !! input
7936 Taiwan is not China.
7937 But -{A|zh:China;zh-tw:Taiwan}- is China,
7938 (This-{-|zh:China;zh-tw:Taiwan}- should be stripped!)
7939 and -{China}- is China.
7940 !! result
7941 <p>Taiwan is not China.
7942 But Taiwan is Taiwan,
7943 (This should be stripped!)
7944 and China is China.
7945 </p>
7946 !! end
7947
7948 !! test
7949 Explicit session-wise language variant mapping (H flag for hide)
7950 !! options
7951 language=zh variant=zh-tw
7952 !! input
7953 (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
7954 Taiwan is China.
7955 !! result
7956 <p>(This should be stripped!)
7957 Taiwan is Taiwan.
7958 </p>
7959 !! end
7960
7961 !! test
7962 Adding explicit conversion rule for title (T flag)
7963 !! options
7964 language=zh variant=zh-tw showtitle
7965 !! input
7966 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7967 !! result
7968 Taiwan
7969 <p>Should be stripped!
7970 </p>
7971 !! end
7972
7973 !! test
7974 Testing that changing the language variant here in the tests actually works
7975 !! options
7976 language=zh variant=zh showtitle
7977 !! input
7978 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7979 !! result
7980 China
7981 <p>Should be stripped!
7982 </p>
7983 !! end
7984
7985 !! test
7986 Bug 24072: more test on conversion rule for title
7987 !! options
7988 language=zh variant=zh-tw showtitle
7989 !! input
7990 This should be stripped-{T|zh:China;zh-tw:Taiwan}-!
7991 This won't take interferes with the title rule-{H|zh:Beijing;zh-tw:Taipei}-.
7992 !! result
7993 Taiwan
7994 <p>This should be stripped!
7995 This won't take interferes with the title rule.
7996 </p>
7997 !! end
7998
7999 !! test
8000 Raw output of variant escape tags (R flag)
8001 !! options
8002 language=zh variant=zh-tw
8003 !! input
8004 Raw: -{R|zh:China;zh-tw:Taiwan}-
8005 !! result
8006 <p>Raw: zh:China;zh-tw:Taiwan
8007 </p>
8008 !! end
8009
8010 !! test
8011 Nested using of manual convert syntax
8012 !! options
8013 language=zh variant=zh-hk
8014 !! input
8015 Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
8016 !! result
8017 <p>Nested: Hello Hong Kong!
8018 </p>
8019 !! end
8020
8021 !! test
8022 Do not convert roman numbers to language variants
8023 !! options
8024 language=sr variant=sr-ec
8025 !! input
8026 Fridrih IV je car.
8027 !! result
8028 <p>Фридрих IV је цар.
8029 </p>
8030 !! end
8031
8032 !! test
8033 Unclosed language converter markup "-{"
8034 !! options
8035 language=sr
8036 !! input
8037 -{T|hello
8038 !! result
8039 <p>-{T|hello
8040 </p>
8041 !! end
8042
8043 !! test
8044 Don't convert raw rule "-{R|=&gt;}-" to "=>"
8045 !! options
8046 language=sr
8047 !! input
8048 -{R|=&gt;}-
8049 !! result
8050 <p>=&gt;
8051 </p>
8052 !!end
8053
8054 !!article
8055 Template:Bullet
8056 !!text
8057 * Bar
8058 !!endarticle
8059
8060 !! test
8061 Bug 529: Uncovered bullet
8062 !! input
8063 * Foo {{bullet}}
8064 !! result
8065 <ul><li> Foo
8066 </li><li> Bar
8067 </li></ul>
8068
8069 !! end
8070
8071 !! test
8072 Bug 529: Uncovered table already at line-start
8073 !! input
8074 x
8075
8076 {{table}}
8077 y
8078 !! result
8079 <p>x
8080 </p>
8081 <table>
8082 <tr>
8083 <td> 1 </td>
8084 <td> 2
8085 </td></tr>
8086 <tr>
8087 <td> 3 </td>
8088 <td> 4
8089 </td></tr></table>
8090 <p>y
8091 </p>
8092 !! end
8093
8094 !! test
8095 Bug 529: Uncovered bullet in parser function result
8096 !! input
8097 * Foo {{lc:{{bullet}} }}
8098 !! result
8099 <ul><li> Foo
8100 </li><li> bar
8101 </li></ul>
8102
8103 !! end
8104
8105 !! test
8106 Bug 5678: Double-parsed template argument
8107 !! input
8108 {{lc:{{{1}}}|hello}}
8109 !! result
8110 <p>{{{1}}}
8111 </p>
8112 !! end
8113
8114 !! test
8115 Bug 5678: Double-parsed template invocation
8116 !! input
8117 {{lc:{{paramtest {{!}} param = hello }} }}
8118 !! result
8119 <p>{{paramtest | param = hello }}
8120 </p>
8121 !! end
8122
8123 !! test
8124 Case insensitivity of parser functions for non-ASCII characters (bug 8143)
8125 !! options
8126 language=cs
8127 title=[[Main Page]]
8128 !! input
8129 {{PRVNÍVELKÉ:ěščř}}
8130 {{prvnívelké:ěščř}}
8131 {{PRVNÍMALÉ:ěščř}}
8132 {{prvnímalé:ěščř}}
8133 {{MALÁ:ěščř}}
8134 {{malá:ěščř}}
8135 {{VELKÁ:ěščř}}
8136 {{velká:ěščř}}
8137 !! result
8138 <p>Ěščř
8139 Ěščř
8140 ěščř
8141 ěščř
8142 ěščř
8143 ěščř
8144 ĚŠČŘ
8145 ĚŠČŘ
8146 </p>
8147 !! end
8148
8149 !! test
8150 Morwen/13: Unclosed link followed by heading
8151 !! input
8152 [[link
8153 ==heading==
8154 !! result
8155 <p>[[link
8156 </p>
8157 <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>
8158
8159 !! end
8160
8161 !! test
8162 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
8163 !! input
8164 {{foo|
8165 =heading=
8166 !! result
8167 <p>{{foo|
8168 </p>
8169 <h1> <span class="mw-headline" id="heading">heading</span></h1>
8170
8171 !! end
8172
8173 !! test
8174 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
8175 !! input
8176 {{foo|
8177 ==heading==
8178 !! result
8179 <p>{{foo|
8180 </p>
8181 <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>
8182
8183 !! end
8184
8185 !! test
8186 Tildes in comments
8187 !! options
8188 pst
8189 !! input
8190 <!-- ~~~~ -->
8191 !! result
8192 <!-- ~~~~ -->
8193 !! end
8194
8195 !! test
8196 Paragraphs inside divs (no extra line breaks)
8197 !! input
8198 <div>Line one
8199
8200 Line two</div>
8201 !! result
8202 <div>Line one
8203 Line two</div>
8204
8205 !! end
8206
8207 !! test
8208 Paragraphs inside divs (extra line break on open)
8209 !! input
8210 <div>
8211 Line one
8212
8213 Line two</div>
8214 !! result
8215 <div>
8216 <p>Line one
8217 </p>
8218 Line two</div>
8219
8220 !! end
8221
8222 !! test
8223 Paragraphs inside divs (extra line break on close)
8224 !! input
8225 <div>Line one
8226
8227 Line two
8228 </div>
8229 !! result
8230 <div>Line one
8231 <p>Line two
8232 </p>
8233 </div>
8234
8235 !! end
8236
8237 !! test
8238 Paragraphs inside divs (extra line break on open and close)
8239 !! input
8240 <div>
8241 Line one
8242
8243 Line two
8244 </div>
8245 !! result
8246 <div>
8247 <p>Line one
8248 </p><p>Line two
8249 </p>
8250 </div>
8251
8252 !! end
8253
8254 !! test
8255 Nesting tags, paragraphs on lines which begin with <div>
8256 !! options
8257 disabled
8258 !! input
8259 <div></div><strong>A
8260 B</strong>
8261 !! result
8262 <div></div>
8263 <p><strong>A
8264 B</strong>
8265 </p>
8266 !! end
8267
8268 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
8269 !! test
8270 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
8271 !! options
8272 disabled
8273 !! input
8274 <blockquote>Line one
8275
8276 Line two</blockquote>
8277 !! result
8278 <blockquote>Line one
8279 Line two</blockquote>
8280
8281 !! end
8282
8283 !! test
8284 Bug 6200: paragraphs inside blockquotes (extra line break on open)
8285 !! options
8286 disabled
8287 !! input
8288 <blockquote>
8289 Line one
8290
8291 Line two</blockquote>
8292 !! result
8293 <blockquote>
8294 <p>Line one
8295 </p>
8296 Line two</blockquote>
8297
8298 !! end
8299
8300 !! test
8301 Bug 6200: paragraphs inside blockquotes (extra line break on close)
8302 !! options
8303 disabled
8304 !! input
8305 <blockquote>Line one
8306
8307 Line two
8308 </blockquote>
8309 !! result
8310 <blockquote>Line one
8311 <p>Line two
8312 </p>
8313 </blockquote>
8314
8315 !! end
8316
8317 !! test
8318 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
8319 !! options
8320 disabled
8321 !! input
8322 <blockquote>
8323 Line one
8324
8325 Line two
8326 </blockquote>
8327 !! result
8328 <blockquote>
8329 <p>Line one
8330 </p><p>Line two
8331 </p>
8332 </blockquote>
8333
8334 !! end
8335
8336 !! test
8337 Paragraphs inside blockquotes/divs (no extra line breaks)
8338 !! input
8339 <blockquote><div>Line one
8340
8341 Line two</div></blockquote>
8342 !! result
8343 <blockquote><div>Line one
8344 Line two</div></blockquote>
8345
8346 !! end
8347
8348 !! test
8349 Paragraphs inside blockquotes/divs (extra line break on open)
8350 !! input
8351 <blockquote><div>
8352 Line one
8353
8354 Line two</div></blockquote>
8355 !! result
8356 <blockquote><div>
8357 <p>Line one
8358 </p>
8359 Line two</div></blockquote>
8360
8361 !! end
8362
8363 !! test
8364 Paragraphs inside blockquotes/divs (extra line break on close)
8365 !! input
8366 <blockquote><div>Line one
8367
8368 Line two
8369 </div></blockquote>
8370 !! result
8371 <blockquote><div>Line one
8372 <p>Line two
8373 </p>
8374 </div></blockquote>
8375
8376 !! end
8377
8378 !! test
8379 Paragraphs inside blockquotes/divs (extra line break on open and close)
8380 !! input
8381 <blockquote><div>
8382 Line one
8383
8384 Line two
8385 </div></blockquote>
8386 !! result
8387 <blockquote><div>
8388 <p>Line one
8389 </p><p>Line two
8390 </p>
8391 </div></blockquote>
8392
8393 !! end
8394
8395 !! test
8396 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
8397 !! options
8398 wgLinkHolderBatchSize=0
8399 !! input
8400 [[meatball:1]]
8401 [[meatball:2]]
8402 [[meatball:3]]
8403 !! result
8404 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
8405 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
8406 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
8407 </p>
8408 !! end
8409
8410 !! test
8411 Free external link invading image caption
8412 !! input
8413 [[Image:Foobar.jpg|thumb|http://x|hello]]
8414 !! result
8415 <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>
8416
8417 !! end
8418
8419 !! test
8420 Bug 15196: localised external link numbers
8421 !! options
8422 language=fa
8423 !! input
8424 [http://en.wikipedia.org/]
8425 !! result
8426 <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
8427 </p>
8428 !! end
8429
8430 !! test
8431 Multibyte character in padleft
8432 !! input
8433 {{padleft:-Hello|7|Æ}}
8434 !! result
8435 <p>Æ-Hello
8436 </p>
8437 !! end
8438
8439 !! test
8440 Multibyte character in padright
8441 !! input
8442 {{padright:Hello-|7|Æ}}
8443 !! result
8444 <p>Hello-Æ
8445 </p>
8446 !! end
8447
8448 !! test
8449 Formatted date
8450 !! config
8451 wgUseDynamicDates=1
8452 !! input
8453 [[2009-03-24]]
8454 !! result
8455 <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>
8456 </p>
8457 !!end
8458
8459 !!test
8460 formatdate parser function
8461 !!input
8462 {{#formatdate:2009-03-24}}
8463 !! result
8464 <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
8465 </p>
8466 !! end
8467
8468 !!test
8469 formatdate parser function, with default format
8470 !!input
8471 {{#formatdate:2009-03-24|mdy}}
8472 !! result
8473 <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
8474 </p>
8475 !! end
8476
8477 !! test
8478 Linked date with autoformatting disabled
8479 !! config
8480 wgUseDynamicDates=false
8481 !! input
8482 [[2009-03-24]]
8483 !! result
8484 <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>
8485 </p>
8486 !! end
8487
8488 !! test
8489 Spacing of numbers in formatted dates
8490 !! input
8491 {{#formatdate:January 15}}
8492 !! result
8493 <p><span class="mw-formatted-date" title="01-15">January 15</span>
8494 </p>
8495 !! end
8496
8497 !! test
8498 Spacing of numbers in formatted dates (linked)
8499 !! config
8500 wgUseDynamicDates=true
8501 !! input
8502 [[January 15]]
8503 !! result
8504 <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>
8505 </p>
8506 !! end
8507
8508 #
8509 #
8510 #
8511
8512 #
8513 # Edit comments
8514 #
8515
8516 !! test
8517 Edit comment with link
8518 !! options
8519 comment
8520 !! input
8521 I like the [[Main Page]] a lot
8522 !! result
8523 I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
8524 !!end
8525
8526 !! test
8527 Edit comment with link and link text
8528 !! options
8529 comment
8530 !! input
8531 I like the [[Main Page|best pages]] a lot
8532 !! result
8533 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8534 !!end
8535
8536 !! test
8537 Edit comment with link and link text with suffix
8538 !! options
8539 comment
8540 !! input
8541 I like the [[Main Page|best page]]s a lot
8542 !! result
8543 I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
8544 !!end
8545
8546 !! test
8547 Edit comment with section link (non-local, eg in history list)
8548 !! options
8549 comment title=[[Main Page]]
8550 !! input
8551 /* External links */ removed bogus entries
8552 !! result
8553 <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
8554 !!end
8555
8556 !! test
8557 Edit comment with section link and text before it (non-local, eg in history list)
8558 !! options
8559 comment title=[[Main Page]]
8560 !! input
8561 pre-comment text /* External links */ removed bogus entries
8562 !! result
8563 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>
8564 !!end
8565
8566 !! test
8567 Edit comment with section link (local, eg in diff view)
8568 !! options
8569 comment local title=[[Main Page]]
8570 !! input
8571 /* External links */ removed bogus entries
8572 !! result
8573 <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
8574 !!end
8575
8576 !! test
8577 Edit comment with subpage link (bug 14080)
8578 !! options
8579 comment
8580 subpage
8581 title=[[Subpage test]]
8582 !! input
8583 Poked at a [[/subpage]] here...
8584 !! result
8585 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
8586 !!end
8587
8588 !! test
8589 Edit comment with subpage link and link text (bug 14080)
8590 !! options
8591 comment
8592 subpage
8593 title=[[Subpage test]]
8594 !! input
8595 Poked at a [[/subpage|neat little page]] here...
8596 !! result
8597 Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
8598 !!end
8599
8600 !! test
8601 Edit comment with bogus subpage link in non-subpage NS (bug 14080)
8602 !! options
8603 comment
8604 title=[[Subpage test]]
8605 !! input
8606 Poked at a [[/subpage]] here...
8607 !! result
8608 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...
8609 !!end
8610
8611 !! test
8612 Edit comment with bare anchor link (local, as on diff)
8613 !! options
8614 comment
8615 local
8616 title=[[Main Page]]
8617 !!input
8618 [[#section]]
8619 !! result
8620 <a href="#section">#section</a>
8621 !! end
8622
8623 !! test
8624 Edit comment with bare anchor link (non-local, as on history)
8625 !! options
8626 comment
8627 title=[[Main Page]]
8628 !!input
8629 [[#section]]
8630 !! result
8631 <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
8632 !! end
8633
8634 !! test
8635 Anchor starting with underscore
8636 !!input
8637 [[#_ref|One]]
8638 !! result
8639 <p><a href="#_ref">One</a>
8640 </p>
8641 !! end
8642
8643 !! test
8644 Id starting with underscore
8645 !!input
8646 <div id="_ref"></div>
8647 !! result
8648 <div id="_ref"></div>
8649
8650 !! end
8651
8652 !! test
8653 Space normalisation on autocomment (bug 22784)
8654 !! options
8655 comment
8656 title=[[Main Page]]
8657 !!input
8658 /* __hello__world__ */
8659 !! result
8660 <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
8661 !! end
8662
8663 !! test
8664 percent-encoding and + signs in comments (Bug 26410)
8665 !! options
8666 comment
8667 !!input
8668 [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
8669 !! result
8670 <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>
8671 !! end
8672
8673 !! test
8674 Bad images - basic functionality
8675 !! options
8676 disabled
8677 !! input
8678 [[File:Bad.jpg]]
8679 !! result
8680 !! end
8681
8682 !! test
8683 Bad images - bug 16039: text after bad image disappears
8684 !! options
8685 disabled
8686 !! input
8687 Foo bar
8688 [[File:Bad.jpg]]
8689 Bar foo
8690 !! result
8691 <p>Foo bar
8692 </p><p>Bar foo
8693 </p>
8694 !! end
8695
8696 !! test
8697 Verify that displaytitle works (bug #22501) no displaytitle
8698 !! options
8699 showtitle
8700 !! config
8701 wgAllowDisplayTitle=true
8702 wgRestrictDisplayTitle=false
8703 !! input
8704 this is not the the title
8705 !! result
8706 Parser test
8707 <p>this is not the the title
8708 </p>
8709 !! end
8710
8711 !! test
8712 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=false
8713 !! options
8714 showtitle
8715 title=[[Screen]]
8716 !! config
8717 wgAllowDisplayTitle=true
8718 wgRestrictDisplayTitle=false
8719 !! input
8720 this is not the the title
8721 {{DISPLAYTITLE:whatever}}
8722 !! result
8723 whatever
8724 <p>this is not the the title
8725 </p>
8726 !! end
8727
8728 !! test
8729 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true mismatch
8730 !! options
8731 showtitle
8732 title=[[Screen]]
8733 !! config
8734 wgAllowDisplayTitle=true
8735 wgRestrictDisplayTitle=true
8736 !! input
8737 this is not the the title
8738 {{DISPLAYTITLE:whatever}}
8739 !! result
8740 Screen
8741 <p>this is not the the title
8742 </p>
8743 !! end
8744
8745 !! test
8746 Verify that displaytitle works (bug #22501) RestrictDisplayTitle=true matching
8747 !! options
8748 showtitle
8749 title=[[Screen]]
8750 !! config
8751 wgAllowDisplayTitle=true
8752 wgRestrictDisplayTitle=true
8753 !! input
8754 this is not the the title
8755 {{DISPLAYTITLE:screen}}
8756 !! result
8757 screen
8758 <p>this is not the the title
8759 </p>
8760 !! end
8761
8762 !! test
8763 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false
8764 !! options
8765 showtitle
8766 title=[[Screen]]
8767 !! config
8768 wgAllowDisplayTitle=false
8769 !! input
8770 this is not the the title
8771 {{DISPLAYTITLE:screen}}
8772 !! result
8773 Screen
8774 <p>this is not the the title
8775 <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>
8776 </p>
8777 !! end
8778
8779 !! test
8780 Verify that displaytitle works (bug #22501) AllowDisplayTitle=false no DISPLAYTITLE
8781 !! options
8782 showtitle
8783 title=[[Screen]]
8784 !! config
8785 wgAllowDisplayTitle=false
8786 !! input
8787 this is not the the title
8788 !! result
8789 Screen
8790 <p>this is not the the title
8791 </p>
8792 !! end
8793
8794 !! test
8795 preload: check <noinclude> and <includeonly>
8796 !! options
8797 preload
8798 !! input
8799 Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
8800 !! result
8801 Hello kind world.
8802 !! end
8803
8804 !! test
8805 preload: check <onlyinclude>
8806 !! options
8807 preload
8808 !! input
8809 Goodbye <onlyinclude>Hello world</onlyinclude>
8810 !! result
8811 Hello world
8812 !! end
8813
8814 !! test
8815 preload: can pass tags through if we want to
8816 !! options
8817 preload
8818 !! input
8819 <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
8820 !! result
8821 <includeonly>Hello world</includeonly>
8822 !! end
8823
8824 !! test
8825 preload: check that it doesn't try to do tricks
8826 !! options
8827 preload
8828 !! input
8829 * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8830 !! result
8831 * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
8832 !! end
8833
8834 !! test
8835 Play a bit with r67090 and bug 3158
8836 !! options
8837 disabled
8838 !! input
8839 <div style="width:50% !important">&nbsp;</div>
8840 <div style="width:50%&nbsp;!important">&nbsp;</div>
8841 <div style="width:50%&#160;!important">&nbsp;</div>
8842 <div style="border : solid;">&nbsp;</div>
8843 !! result
8844 <div style="width:50% !important">&nbsp;</div>
8845 <div style="width:50% !important">&nbsp;</div>
8846 <div style="width:50% !important">&nbsp;</div>
8847 <div style="border&#160;: solid;">&nbsp;</div>
8848
8849 !! end
8850
8851 !! test
8852 HTML5 data attributes
8853 !! input
8854 <span data-foo="bar">Baz</span>
8855 <p data-abc-def_hij="">Quuz</p>
8856 !! result
8857 <p><span data-foo="bar">Baz</span>
8858 </p>
8859 <p data-abc-def_hij="">Quuz</p>
8860
8861 !! end
8862
8863 !! test
8864 percent-encoding and + signs in internal links (Bug 26410)
8865 !! input
8866 [[User:+%]] [[Page+title%]]
8867 [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
8868 [[%]] [[+]] [[image:%+abc%39|foo|[[bar]]]]
8869 [[%33%45]] [[%33%45+]]
8870 !! result
8871 <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>
8872 <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>
8873 <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>
8874 <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>
8875 </p>
8876 !! end
8877
8878 !! test
8879 Special characters in embedded file links (bug 27679)
8880 !! input
8881 [[File:Contains & ampersand.jpg]]
8882 [[File:Does not exist.jpg|Title with & ampersand]]
8883 !! result
8884 <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>
8885 <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>
8886 </p>
8887 !! end
8888
8889
8890 !! test
8891 Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
8892 !! input
8893 Text&apos;s been normalized?
8894 !! result
8895 <p>Text&#39;s been normalized?
8896 </p>
8897 !! end
8898
8899 !! test
8900 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
8901 !! input
8902 http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
8903 !! result
8904 <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
8905 </p>
8906 !! end
8907
8908 !! test
8909 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
8910 !! input
8911 [http://www.example.org/ ideograms]
8912 !! result
8913 <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
8914 </p>
8915 !! end
8916
8917 !! test
8918 Bug 19052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
8919 !! input
8920 http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
8921 !! result
8922 <p><img src="http://www.example.org/pic.png" alt="pic.png" /> &lt;-- U+3000 (vim: ^Vu3000)
8923 </p>
8924 !! end
8925
8926 !! article
8927 Mediawiki:loop1
8928 !! text
8929 {{Identical|A}}
8930 !! endarticle
8931
8932 !! article
8933 Mediawiki:loop2
8934 !! text
8935 {{Identical|B}}
8936 !! endarticle
8937
8938 !! article
8939 Template:Identical
8940 !! text
8941 {{int:loop1}}
8942 {{int:loop2}}
8943 !! endarticle
8944
8945 !! test
8946 Bug 31098 Template which includes system messages which includes the template
8947 !! input
8948 {{Identical}}
8949 !! result
8950 <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
8951 <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
8952 </p>
8953 !! end
8954
8955 !! test
8956 Deprecated presentational attributes are converted to css
8957 !! input
8958 {|
8959 | valign=top align=left width=100 height=25% | Asdf
8960 |}
8961 <ul type="disc"></ul>
8962 !! result
8963 <table>
8964 <tr>
8965 <td style="text-align: left; height: 25%; vertical-align: top; width: 100px;"> Asdf
8966 </td></tr></table>
8967 <ul style="list-style-type: disc;"></ul>
8968
8969 !! end
8970
8971 !! test
8972 Bug31490 Turkish: ucfirst 'blah'
8973 !! options
8974 language=tr
8975 !! input
8976 {{ucfirst:blah}}
8977 !! result
8978 <p>Blah
8979 </p>
8980 !! end
8981
8982 !! test
8983 Bug31490 Turkish: ucfirst 'ix'
8984 !! options
8985 language=tr
8986 !! input
8987 {{ucfirst:ix}}
8988 !! result
8989 <p>İx
8990 </p>
8991 !! end
8992
8993 !! test
8994 Bug31490 Turkish: lcfirst 'BLAH'
8995 !! options
8996 language=tr
8997 !! input
8998 {{lcfirst:BLAH}}
8999 !! result
9000 <p>bLAH
9001 </p>
9002 !! end
9003
9004 !! test
9005 Bug31490 Turkish: ucfırst (with a dotless i)
9006 !! options
9007 language=tr
9008 !! input
9009 {{ucfırst:blah}}
9010 !! result
9011 <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>
9012 </p>
9013 !! end
9014
9015 !! test
9016 Bug31490 ucfırst (with a dotless i) with English language
9017 !! options
9018 language=en
9019 !! input
9020 {{ucfırst:blah}}
9021 !! result
9022 <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>
9023 </p>
9024 !! end
9025
9026 !! test
9027 Bug 26375: TOC with italics
9028 !! options
9029 title=[[Main Page]]
9030 !! input
9031 __TOC__
9032 == ''Lost'' episodes ==
9033 !! result
9034 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9035 <ul>
9036 <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>
9037 </ul>
9038 </td></tr></table>
9039 <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>
9040
9041 !! end
9042
9043 !! test
9044 Bug 26375: TOC with bold
9045 !! options
9046 title=[[Main Page]]
9047 !! input
9048 __TOC__
9049 == '''should be bold''' then normal text ==
9050 !! result
9051 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9052 <ul>
9053 <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>
9054 </ul>
9055 </td></tr></table>
9056 <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>
9057
9058 !! end
9059
9060 !! test
9061 Bug 33845: Headings become cursive in TOC when they contain an image
9062 !! options
9063 title=[[Main Page]]
9064 !! input
9065 __TOC__
9066 == Image [[Image:foobar.jpg]] ==
9067 !! result
9068 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9069 <ul>
9070 <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
9071 </ul>
9072 </td></tr></table>
9073 <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>
9074
9075 !! end
9076
9077 !! test
9078 Bug 33845 (2): Headings become bold in TOC when they contain a blockquote
9079 !! options
9080 title=[[Main Page]]
9081 !! input
9082 __TOC__
9083 == <blockquote>Quote</blockquote> ==
9084 !! result
9085 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9086 <ul>
9087 <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
9088 </ul>
9089 </td></tr></table>
9090 <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>
9091
9092 !! end
9093
9094 !! test
9095 Unclosed tags in TOC
9096 !! options
9097 title=[[Main Page]]
9098 !! input
9099 __TOC__
9100 == Proof: 2 < 3 ==
9101 <small>Hanc marginis exiguitas non caperet.</small>
9102 QED
9103 !! result
9104 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9105 <ul>
9106 <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>
9107 </ul>
9108 </td></tr></table>
9109 <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>
9110 <p><small>Hanc marginis exiguitas non caperet.</small>
9111 QED
9112 </p>
9113 !! end
9114
9115 !! test
9116 Multiple tags in TOC
9117 !! input
9118 __TOC__
9119 == <i>Foo</i> <b>Bar</b> ==
9120
9121 == <i>Foo</i> <blockquote>Bar</blockquote> ==
9122 !! result
9123 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9124 <ul>
9125 <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>
9126 <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>
9127 </ul>
9128 </td></tr></table>
9129 <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>
9130 <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>
9131
9132 !! end
9133
9134 !! test
9135 Tags with parameters in TOC
9136 !! input
9137 __TOC__
9138 == <sup class="in-h2">Hello</sup> ==
9139
9140 == <sup class="a > b">Evilbye</sup> ==
9141 !! result
9142 <table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
9143 <ul>
9144 <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
9145 <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>
9146 </ul>
9147 </td></tr></table>
9148 <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>
9149 <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>
9150
9151 !! end
9152
9153 !! article
9154 MediaWiki:Bug32057
9155 !! text
9156 == {{int:headline_sample}} ==
9157 !! endarticle
9158
9159 !! test
9160 Bug 32057: Title needed when expanding <h> nodes.
9161 !! options
9162 title=[[Main Page]]
9163 !! input
9164 {{int:Bug32057}}
9165 !! result
9166 <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>
9167
9168 !! end
9169
9170 !! test
9171 Strip marker in urlencode
9172 !! input
9173 {{urlencode:x<nowiki/>y}}
9174 {{urlencode:x<nowiki/>y|wiki}}
9175 {{urlencode:x<nowiki/>y|path}}
9176 !! result
9177 <p>xy
9178 xy
9179 xy
9180 </p>
9181 !! end
9182
9183 !! test
9184 Strip marker in lc
9185 !! input
9186 {{lc:x<nowiki/>y}}
9187 !! result
9188 <p>xy
9189 </p>
9190 !! end
9191
9192 !! test
9193 Strip marker in uc
9194 !! input
9195 {{uc:x<nowiki/>y}}
9196 !! result
9197 <p>XY
9198 </p>
9199 !! end
9200
9201 !! test
9202 Strip marker in formatNum
9203 !! input
9204 {{formatnum:1<nowiki/>2}}
9205 {{formatnum:1<nowiki/>2|R}}
9206 !! result
9207 <p>12
9208 12
9209 </p>
9210 !! end
9211
9212 !! test
9213 Strip marker in grammar
9214 !! options
9215 language=fi
9216 !! input
9217 {{grammar:elative|foo<nowiki/>bar}}
9218 !! result
9219 <p>foobarista
9220 </p>
9221 !! end
9222
9223 !! test
9224 Strip marker in padleft
9225 !! input
9226 {{padleft:|2|x<nowiki/>y}}
9227 !! result
9228 <p>xy
9229 </p>
9230 !! end
9231
9232 !! test
9233 Strip marker in padright
9234 !! input
9235 {{padright:|2|x<nowiki/>y}}
9236 !! result
9237 <p>xy
9238 </p>
9239 !! end
9240
9241 !! test
9242 Strip marker in anchorencode
9243 !! input
9244 {{anchorencode:x<nowiki/>y}}
9245 !! result
9246 <p>xy
9247 </p>
9248 !! end
9249
9250 !! test
9251 nowiki inside link inside heading (bug 18295)
9252 !! input
9253 ==[[foo|x<nowiki>y</nowiki>z]]==
9254 !! result
9255 <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>
9256
9257 !! end
9258
9259 !! test
9260 new support for bdi element (bug 31817)
9261 !! input
9262 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
9263 !! result
9264 <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
9265
9266 !!end
9267
9268 !! test
9269 Ignore pipe between table row attributes
9270 !! input
9271 {|
9272 | quux
9273 |- id=foo | style='color: red'
9274 | bar
9275 |}
9276 !! result
9277 <table>
9278 <tr>
9279 <td> quux
9280 </td></tr>
9281 <tr id="foo" style="color: red">
9282 <td> bar
9283 </td></tr></table>
9284
9285 !! end
9286
9287 !!test
9288 Gallery override link with WikiLink (bug 34852)
9289 !! input
9290 <gallery>
9291 File:foobar.jpg|caption|alt=galleryalt|link=InterWikiLink
9292 </gallery>
9293 !! result
9294 <ul class="gallery">
9295 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9296 <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>
9297 <div class="gallerytext">
9298 <p>caption
9299 </p>
9300 </div>
9301 </div></li>
9302 </ul>
9303
9304 !! end
9305
9306 !!test
9307 Gallery override link with absolute external link (bug 34852)
9308 !! input
9309 <gallery>
9310 File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
9311 </gallery>
9312 !! result
9313 <ul class="gallery">
9314 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9315 <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>
9316 <div class="gallerytext">
9317 <p>caption
9318 </p>
9319 </div>
9320 </div></li>
9321 </ul>
9322
9323 !! end
9324
9325 !!test
9326 Gallery override link with malicious javascript (bug 34852)
9327 !! input
9328 <gallery>
9329 File:foobar.jpg|caption|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
9330 </gallery>
9331 !! result
9332 <ul class="gallery">
9333 <li class="gallerybox" style="width: 155px"><div style="width: 155px">
9334 <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>
9335 <div class="gallerytext">
9336 <p>caption
9337 </p>
9338 </div>
9339 </div></li>
9340 </ul>
9341
9342 !! end
9343
9344 !!test
9345 Language parser function
9346 !! input
9347 {{#language:ar}}
9348 !! result
9349 <p>العربية
9350 </p>
9351 !! end
9352
9353 TODO:
9354 more images
9355 more tables
9356 math
9357 character entities
9358 and much more
9359 Try for 100% code coverage