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