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