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