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