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