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