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