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