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