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