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