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