Restore all the search messages destroyed by r42366
[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="Image:Noimage.png">Image:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (not yet written)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (not yet written)">caption</a></div></div></div>
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/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
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/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div>
3085
3086 !! end
3087
3088 !! test
3089 Image with caption
3090 !! input
3091 [[Image:foobar.jpg|right|Caption text]]
3092 !! result
3093 <div class="floatright"><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div>
3094
3095 !! end
3096
3097 !! test
3098 Image with link parameter, wiki target
3099 !! input
3100 [[Image:foobar.jpg|link=Target page]]
3101 !! result
3102 <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>
3103 </p>
3104 !! end
3105
3106 !! test
3107 Image with link parameter, URL target
3108 !! input
3109 [[Image:foobar.jpg|link=http://example.com/]]
3110 !! result
3111 <p><a href="http://example.com/"><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 empty link parameter
3117 !! input
3118 [[Image:foobar.jpg|link=]]
3119 !! result
3120 <p><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" />
3121 </p>
3122 !! end
3123
3124
3125
3126 !! test
3127 Image with frame and link
3128 !! input
3129 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
3130 !! result
3131 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is a test image Main Page"><img alt="" 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>
3132
3133 !! end
3134
3135 !! test
3136 Image with frame and link and explicit alt
3137 !! input
3138 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
3139 !! result
3140 <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is a test image Main Page"><img alt="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>
3141
3142 !! end
3143
3144 !! test
3145 Image with wiki markup in implicit alt
3146 !! input
3147 [[Image:Foobar.jpg|testing '''bold''' in alt]]
3148 !! result
3149 <p><a href="/wiki/Image: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>
3150 </p>
3151 !! end
3152
3153 !! test
3154 Image with wiki markup in explicit alt
3155 !! input
3156 [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
3157 !! result
3158 <p><a href="/wiki/Image: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>
3159 </p>
3160 !! end
3161
3162 !! test
3163 Link to image page- image page normally doesn't exists, hence edit link
3164 Add test with existing image page
3165 #<p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
3166 !! input
3167 [[:Image:test]]
3168 !! result
3169 <p><a href="/index.php?title=Image:Test&amp;action=edit&amp;redlink=1" class="new" title="Image:Test (not yet written)">Image:test</a>
3170 </p>
3171 !! end
3172
3173 !! test
3174 Frameless image caption with a free URL
3175 !! input
3176 [[Image:foobar.jpg|http://example.com]]
3177 !! result
3178 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3179 </p>
3180 !! end
3181
3182 !! test
3183 Thumbnail image caption with a free URL
3184 !! input
3185 [[Image:foobar.jpg|thumb|http://example.com]]
3186 !! result
3187 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image: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/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
3188
3189 !! end
3190
3191 !! test
3192 Thumbnail image caption with a free URL and explicit alt
3193 !! input
3194 [[Image:foobar.jpg|thumb|http://example.com|alt=Alteration]]
3195 !! result
3196 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image: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/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
3197
3198 !! end
3199
3200 !! test
3201 BUG 1887: A ISBN with a thumbnail
3202 !! input
3203 [[Image:foobar.jpg|thumb|ISBN 1235467890]]
3204 !! result
3205 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image: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/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal">ISBN 1235467890</a></div></div></div>
3206
3207 !! end
3208
3209 !! test
3210 BUG 1887: A RFC with a thumbnail
3211 !! input
3212 [[Image:foobar.jpg|thumb|This is RFC 12354]]
3213 !! result
3214 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is RFC 12354"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is <a href="http://tools.ietf.org/html/rfc12354" class="external" title="http://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
3215
3216 !! end
3217
3218 !! test
3219 BUG 1887: A mailto link with a thumbnail
3220 !! input
3221 [[Image:foobar.jpg|thumb|Please mailto:nobody@example.com]]
3222 !! result
3223 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="Please mailto:nobody@example.com"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>Please <a href="mailto:nobody@example.com" class="external free" title="mailto:nobody@example.com" rel="nofollow">mailto:nobody@example.com</a></div></div></div>
3224
3225 !! end
3226
3227 !! test
3228 BUG 1887: A <math> with a thumbnail- we don't render math in the parsertests by default,
3229 so math is not stripped and turns up as escaped &lt;math&gt; tags.
3230 !! input
3231 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3232 !! result
3233 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="&lt;math&gt;2+2&lt;/math&gt;"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>&lt;math&gt;2+2&lt;/math&gt;</div></div></div>
3234
3235 !! end
3236
3237 !! test
3238 BUG 1887, part 2: A <math> with a thumbnail- math enabled
3239 !! options
3240 math
3241 !! input
3242 [[Image:foobar.jpg|thumb|<math>2+2</math>]]
3243 !! result
3244 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image: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/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div><span class="texhtml">2 + 2</span></div></div></div>
3245
3246 !! end
3247
3248 # Pending resolution to bug 368
3249 !! test
3250 BUG 648: Frameless image caption with a link
3251 !! input
3252 [[Image:foobar.jpg|text with a [[link]] in it]]
3253 !! result
3254 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3255 </p>
3256 !! end
3257
3258 !! test
3259 BUG 648: Frameless image caption with a link (suffix)
3260 !! input
3261 [[Image:foobar.jpg|text with a [[link]]foo in it]]
3262 !! result
3263 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3264 </p>
3265 !! end
3266
3267 !! test
3268 BUG 648: Frameless image caption with an interwiki link
3269 !! input
3270 [[Image:foobar.jpg|text with a [[MeatBall:Link]] in it]]
3271 !! result
3272 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3273 </p>
3274 !! end
3275
3276 !! test
3277 BUG 648: Frameless image caption with a piped interwiki link
3278 !! input
3279 [[Image:foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
3280 !! result
3281 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3282 </p>
3283 !! end
3284
3285 !! test
3286 Escape HTML special chars in image alt text
3287 !! input
3288 [[Image:foobar.jpg|& < > "]]
3289 !! result
3290 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3291 </p>
3292 !! end
3293
3294 !! test
3295 BUG 499: Alt text should have &#1234;, not &amp;1234;
3296 !! input
3297 [[Image:foobar.jpg|&#9792;]]
3298 !! result
3299 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3300 </p>
3301 !! end
3302
3303 !! test
3304 Broken image caption with link
3305 !! input
3306 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
3307 !! result
3308 <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.
3309 </p>
3310 !! end
3311
3312 !! test
3313 Image caption containing another image
3314 !! input
3315 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
3316 !! result
3317 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This is a caption with another Image:Icon.png inside it!"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This is a caption with another <a href="/index.php?title=Special:Upload&amp;wpDestFile=Icon.png" class="new" title="Image:Icon.png">Image:Icon.png</a> inside it!</div></div></div>
3318
3319 !! end
3320
3321 !! test
3322 Image caption containing a newline
3323 !! input
3324 [[Image:Foobar.jpg|This
3325 *is some text]]
3326 !! result
3327 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3328 </p>
3329 !!end
3330
3331
3332 !! test
3333 Bug 3090: External links other than http: in image captions
3334 !! input
3335 [[Image:Foobar.jpg|thumb|200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
3336 !! result
3337 <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="This caption has irc and Secure ext links in it."><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>This caption has <a href="irc://example.net" class="external text" title="irc://example.net" rel="nofollow">irc</a> and <a href="https://example.com" class="external text" title="https://example.com" rel="nofollow">Secure</a> ext links in it.</div></div></div>
3338
3339 !! end
3340
3341
3342 ###
3343 ### Subpages
3344 ###
3345 !! article
3346 Subpage test/subpage
3347 !! text
3348 foo
3349 !! endarticle
3350
3351 !! test
3352 Subpage link
3353 !! options
3354 subpage title=[[Subpage test]]
3355 !! input
3356 [[/subpage]]
3357 !! result
3358 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
3359 </p>
3360 !! end
3361
3362 !! test
3363 Subpage noslash link
3364 !! options
3365 subpage title=[[Subpage test]]
3366 !!input
3367 [[/subpage/]]
3368 !! result
3369 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
3370 </p>
3371 !! end
3372
3373 !! test
3374 Disabled subpages
3375 !! input
3376 [[/subpage]]
3377 !! result
3378 <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (not yet written)">/subpage</a>
3379 </p>
3380 !! end
3381
3382 !! test
3383 BUG 561: {{/Subpage}}
3384 !! options
3385 subpage title=[[Page]]
3386 !! input
3387 {{/Subpage}}
3388 !! result
3389 <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>
3390 </p>
3391 !! end
3392
3393 ###
3394 ### Categories
3395 ###
3396 !! article
3397 Category:MediaWiki User's Guide
3398 !! text
3399 blah
3400 !! endarticle
3401
3402 !! test
3403 Link to category
3404 !! input
3405 [[:Category:MediaWiki User's Guide]]
3406 !! result
3407 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
3408 </p>
3409 !! end
3410
3411 !! test
3412 Simple category
3413 !! options
3414 cat
3415 !! input
3416 [[Category:MediaWiki User's Guide]]
3417 !! result
3418 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#039;s Guide">MediaWiki User's Guide</a>
3419 !! end
3420
3421 !! test
3422 PAGESINCATEGORY invalid title fatal (r33546 fix)
3423 !! input
3424 {{PAGESINCATEGORY:<bogus>}}
3425 !! result
3426 <p>0
3427 </p>
3428 !! end
3429
3430 ###
3431 ### Inter-language links
3432 ###
3433 !! test
3434 Inter-language links
3435 !! options
3436 ill
3437 !! input
3438 [[es:Alimento]]
3439 [[fr:Nourriture]]
3440 [[zh:&#39135;&#21697;]]
3441 !! result
3442 es:Alimento fr:Nourriture zh:食品
3443 !! end
3444
3445 ###
3446 ### Sections
3447 ###
3448 !! test
3449 Basic section headings
3450 !! input
3451 == Headline 1 ==
3452 Some text
3453
3454 ==Headline 2==
3455 More
3456 ===Smaller headline===
3457 Blah blah
3458 !! result
3459 <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>
3460 <p>Some text
3461 </p>
3462 <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>
3463 <p>More
3464 </p>
3465 <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>
3466 <p>Blah blah
3467 </p>
3468 !! end
3469
3470 !! test
3471 Section headings with TOC
3472 !! input
3473 == Headline 1 ==
3474 === Subheadline 1 ===
3475 ===== Skipping a level =====
3476 ====== Skipping a level ======
3477
3478 == Headline 2 ==
3479 Some text
3480 ===Another headline===
3481 !! result
3482 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3483 <ul>
3484 <li class="toclevel-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
3485 <ul>
3486 <li class="toclevel-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
3487 <ul>
3488 <li class="toclevel-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
3489 <ul>
3490 <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>
3491 </ul>
3492 </li>
3493 </ul>
3494 </li>
3495 </ul>
3496 </li>
3497 <li class="toclevel-1"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
3498 <ul>
3499 <li class="toclevel-2"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
3500 </ul>
3501 </li>
3502 </ul>
3503 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3504 <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>
3505 <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>
3506 <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>
3507 <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>
3508 <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>
3509 <p>Some text
3510 </p>
3511 <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>
3512
3513 !! end
3514
3515 # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
3516 !! test
3517 Handling of sections up to level 6 and beyond
3518 !! input
3519 = Level 1 Heading=
3520 == Level 2 Heading==
3521 === Level 3 Heading===
3522 ==== Level 4 Heading====
3523 ===== Level 5 Heading=====
3524 ====== Level 6 Heading======
3525 ======= Level 7 Heading=======
3526 ======== Level 8 Heading========
3527 ========= Level 9 Heading=========
3528 ========== Level 10 Heading==========
3529 !! result
3530 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3531 <ul>
3532 <li class="toclevel-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
3533 <ul>
3534 <li class="toclevel-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
3535 <ul>
3536 <li class="toclevel-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
3537 <ul>
3538 <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>
3539 <ul>
3540 <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>
3541 <ul>
3542 <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>
3543 <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>
3544 <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>
3545 <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>
3546 <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>
3547 </ul>
3548 </li>
3549 </ul>
3550 </li>
3551 </ul>
3552 </li>
3553 </ul>
3554 </li>
3555 </ul>
3556 </li>
3557 </ul>
3558 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3559 <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>
3560 <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>
3561 <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>
3562 <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>
3563 <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>
3564 <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>
3565 <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>
3566 <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>
3567 <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>
3568 <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>
3569
3570 !! end
3571
3572 !! test
3573 TOC regression (bug 9764)
3574 !! input
3575 == title 1 ==
3576 === title 1.1 ===
3577 ==== title 1.1.1 ====
3578 === title 1.2 ===
3579 == title 2 ==
3580 === title 2.1 ===
3581 !! result
3582 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3583 <ul>
3584 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3585 <ul>
3586 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
3587 <ul>
3588 <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>
3589 </ul>
3590 </li>
3591 <li class="toclevel-2"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3592 </ul>
3593 </li>
3594 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3595 <ul>
3596 <li class="toclevel-2"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3597 </ul>
3598 </li>
3599 </ul>
3600 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3601 <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>
3602 <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>
3603 <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>
3604 <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>
3605 <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>
3606 <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>
3607
3608 !! end
3609
3610 !! test
3611 TOC with wgMaxTocLevel=3 (bug 6204)
3612 !! options
3613 wgMaxTocLevel=3
3614 !! input
3615 == title 1 ==
3616 === title 1.1 ===
3617 ==== title 1.1.1 ====
3618 === title 1.2 ===
3619 == title 2 ==
3620 === title 2.1 ===
3621 !! result
3622 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3623 <ul>
3624 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3625 <ul>
3626 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
3627 <li class="toclevel-2"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
3628 </ul>
3629 </li>
3630 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
3631 <ul>
3632 <li class="toclevel-2"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
3633 </ul>
3634 </li>
3635 </ul>
3636 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3637 <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>
3638 <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>
3639 <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>
3640 <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>
3641 <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>
3642 <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>
3643
3644 !! end
3645
3646 !! test
3647 Resolving duplicate section names
3648 !! input
3649 == Foo bar ==
3650 == Foo bar ==
3651 !! result
3652 <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>
3653 <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>
3654
3655 !! end
3656
3657 !! test
3658 Resolving duplicate section names with differing case (bug 10721)
3659 !! input
3660 == Foo bar ==
3661 == Foo Bar ==
3662 !! result
3663 <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>
3664 <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>
3665
3666 !! end
3667
3668 !! article
3669 Template:sections
3670 !! text
3671 ===Section 1===
3672 ==Section 2==
3673 !! endarticle
3674
3675 !! test
3676 Template with sections, __NOTOC__
3677 !! input
3678 __NOTOC__
3679 ==Section 0==
3680 {{sections}}
3681 ==Section 4==
3682 !! result
3683 <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>
3684 <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>
3685 <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>
3686 <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>
3687
3688 !! end
3689
3690 !! test
3691 __NOEDITSECTION__ keyword
3692 !! input
3693 __NOEDITSECTION__
3694 ==Section 1==
3695 ==Section 2==
3696 !! result
3697 <a name="Section_1"></a><h2> <span class="mw-headline">Section 1</span></h2>
3698 <a name="Section_2"></a><h2> <span class="mw-headline">Section 2</span></h2>
3699
3700 !! end
3701
3702 !! test
3703 Link inside a section heading
3704 !! input
3705 ==Section with a [[Main Page|link]] in it==
3706 !! result
3707 <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>
3708
3709 !! end
3710
3711 !! test
3712 TOC regression (bug 12077)
3713 !! input
3714 __TOC__
3715 == title 1 ==
3716 === title 1.1 ===
3717 == title 2 ==
3718 !! result
3719 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
3720 <ul>
3721 <li class="toclevel-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
3722 <ul>
3723 <li class="toclevel-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
3724 </ul>
3725 </li>
3726 <li class="toclevel-1"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
3727 </ul>
3728 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
3729 <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>
3730 <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>
3731 <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>
3732
3733 !! end
3734
3735 !! test
3736 BUG 1219 URL next to image (good)
3737 !! input
3738 http://example.com [[Image:foobar.jpg]]
3739 !! result
3740 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> <a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3741 </p>
3742 !!end
3743
3744 !! test
3745 BUG 1219 URL next to image (broken)
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/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img alt="Image:foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a>
3750 </p>
3751 !!end
3752
3753 !! test
3754 Bug 1186 news: in the middle of text
3755 !! input
3756 http://en.wikinews.org/wiki/Wikinews:Workplace
3757 !! result
3758 <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>
3759 </p>
3760 !!end
3761
3762
3763 !! test
3764 Namespaced link must have a title
3765 !! input
3766 [[Project:]]
3767 !! result
3768 <p>[[Project:]]
3769 </p>
3770 !!end
3771
3772 !! test
3773 Namespaced link must have a title (bad fragment version)
3774 !! input
3775 [[Project:#fragment]]
3776 !! result
3777 <p>[[Project:#fragment]]
3778 </p>
3779 !!end
3780
3781
3782 !! test
3783 div with no attributes
3784 !! input
3785 <div>HTML rocks</div>
3786 !! result
3787 <div>HTML rocks</div>
3788
3789 !! end
3790
3791 !! test
3792 div with double-quoted attribute
3793 !! input
3794 <div id="rock">HTML rocks</div>
3795 !! result
3796 <div id="rock">HTML rocks</div>
3797
3798 !! end
3799
3800 !! test
3801 div with single-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 unquoted 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 illegal double attributes
3820 !! input
3821 <div align="center" align="right">HTML rocks</div>
3822 !! result
3823 <div align="right">HTML rocks</div>
3824
3825 !!end
3826
3827 !! test
3828 HTML multiple attributes correction
3829 !! input
3830 <p class="error" class="awesome">Awesome!</p>
3831 !! result
3832 <p class="awesome">Awesome!</p>
3833
3834 !!end
3835
3836 !! test
3837 Table multiple attributes correction
3838 !! input
3839 {|
3840 !+ class="error" class="awesome"| status
3841 |}
3842 !! result
3843 <table>
3844 <tr>
3845 <th class="awesome"> status
3846 </th></tr></table>
3847
3848 !!end
3849
3850 !! test
3851 DIV IN UPPERCASE
3852 !! input
3853 <DIV ALIGN="center">HTML ROCKS</DIV>
3854 !! result
3855 <div align="center">HTML ROCKS</div>
3856
3857 !!end
3858
3859
3860 !! test
3861 text with amp in the middle of nowhere
3862 !! input
3863 Remember AT&T?
3864 !!result
3865 <p>Remember AT&amp;T?
3866 </p>
3867 !! end
3868
3869 !! test
3870 text with character entity: eacute
3871 !! input
3872 I always thought &eacute; was a cute letter.
3873 !! result
3874 <p>I always thought &eacute; was a cute letter.
3875 </p>
3876 !! end
3877
3878 !! test
3879 text with undefined character entity: xacute
3880 !! input
3881 I always thought &xacute; was a cute letter.
3882 !! result
3883 <p>I always thought &amp;xacute; was a cute letter.
3884 </p>
3885 !! end
3886
3887
3888 ###
3889 ### Media links
3890 ###
3891
3892 !! test
3893 Media link
3894 !! input
3895 [[Media:Foobar.jpg]]
3896 !! result
3897 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
3898 </p>
3899 !! end
3900
3901 !! test
3902 Media link with text
3903 !! input
3904 [[Media:Foobar.jpg|A neat file to look at]]
3905 !! result
3906 <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
3907 </p>
3908 !! end
3909
3910 # FIXME: this is still bad HTML tag nesting
3911 !! test
3912 Media link with nasty text
3913 fixme: doBlockLevels won't wrap this in a paragraph because it contains a div
3914 !! input
3915 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
3916 !! result
3917 <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>
3918
3919 !! end
3920
3921 !! test
3922 Media link to nonexistent file (bug 1702)
3923 !! input
3924 [[Media:No such.jpg]]
3925 !! result
3926 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
3927 </p>
3928 !! end
3929
3930 !! test
3931 Image link to nonexistent file (bug 1850 - good)
3932 !! input
3933 [[Image:No such.jpg]]
3934 !! result
3935 <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="Image:No such.jpg">Image:No such.jpg</a>
3936 </p>
3937 !! end
3938
3939 !! test
3940 :Image link to nonexistent file (bug 1850 - bad)
3941 !! input
3942 [[:Image:No such.jpg]]
3943 !! result
3944 <p><a href="/index.php?title=Image:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="Image:No such.jpg (not yet written)">Image:No such.jpg</a>
3945 </p>
3946 !! end
3947
3948
3949
3950 !! test
3951 Character reference normalization in link text (bug 1938)
3952 !! input
3953 [[Main Page|this&that]]
3954 !! result
3955 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
3956 </p>
3957 !!end
3958
3959 !! test
3960 Empty attribute crash test (bug 2067)
3961 !! input
3962 <font color="">foo</font>
3963 !! result
3964 <p><font color="">foo</font>
3965 </p>
3966 !! end
3967
3968 !! test
3969 Empty attribute crash test single-quotes (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 Attribute test: equals, then nothing
3979 !! input
3980 <font color=>foo</font>
3981 !! result
3982 <p><font>foo</font>
3983 </p>
3984 !! end
3985
3986 !! test
3987 Attribute test: unquoted value
3988 !! input
3989 <font color=x>foo</font>
3990 !! result
3991 <p><font color="x">foo</font>
3992 </p>
3993 !! end
3994
3995 !! test
3996 Attribute test: unquoted but illegal value (hash)
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: no value
4006 !! input
4007 <font color>foo</font>
4008 !! result
4009 <p><font color="color">foo</font>
4010 </p>
4011 !! end
4012
4013 !! test
4014 Bug 2095: link with three closing brackets
4015 !! input
4016 [[Main Page]]]
4017 !! result
4018 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
4019 </p>
4020 !! end
4021
4022 !! test
4023 Bug 2095: link with pipe and three closing brackets
4024 !! input
4025 [[Main Page|link]]]
4026 !! result
4027 <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
4028 </p>
4029 !! end
4030
4031 !! test
4032 Bug 2095: link with pipe and three closing brackets, version 2
4033 !! input
4034 [[Main Page|[http://example.com/]]]
4035 !! result
4036 <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
4037 </p>
4038 !! end
4039
4040
4041 ###
4042 ### Safety
4043 ###
4044
4045 !! article
4046 Template:Dangerous attribute
4047 !! text
4048 " onmouseover="alert(document.cookie)
4049 !! endarticle
4050
4051 !! article
4052 Template:Dangerous style attribute
4053 !! text
4054 border-size: expression(alert(document.cookie))
4055 !! endarticle
4056
4057 !! article
4058 Template:Div style
4059 !! text
4060 <div style="float: right; {{{1}}}">Magic div</div>
4061 !! endarticle
4062
4063 !! test
4064 Bug 2304: HTML attribute safety (safe template; regression bug 2309)
4065 !! input
4066 <div title="{{test}}"></div>
4067 !! result
4068 <div title="This is a test template"></div>
4069
4070 !! end
4071
4072 !! test
4073 Bug 2304: HTML attribute safety (dangerous template; 2309)
4074 !! input
4075 <div title="{{dangerous attribute}}"></div>
4076 !! result
4077 <div title=""></div>
4078
4079 !! end
4080
4081 !! test
4082 Bug 2304: HTML attribute safety (dangerous style template; 2309)
4083 !! input
4084 <div style="{{dangerous style attribute}}"></div>
4085 !! result
4086 <div></div>
4087
4088 !! end
4089
4090 !! test
4091 Bug 2304: HTML attribute safety (safe parameter; 2309)
4092 !! input
4093 {{div style|width: 200px}}
4094 !! result
4095 <div style="float: right; width: 200px">Magic div</div>
4096
4097 !! end
4098
4099 !! test
4100 Bug 2304: HTML attribute safety (unsafe parameter; 2309)
4101 !! input
4102 {{div style|width: expression(alert(document.cookie))}}
4103 !! result
4104 <div>Magic div</div>
4105
4106 !! end
4107
4108 !! test
4109 Bug 2304: HTML attribute safety (unsafe breakout parameter; 2309)
4110 !! input
4111 {{div style|"><script>alert(document.cookie)</script>}}
4112 !! result
4113 <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
4114
4115 !! end
4116
4117 !! test
4118 Bug 2304: HTML attribute safety (unsafe breakout parameter 2; 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 (link)
4128 !! input
4129 <div title="[[Main Page]]"></div>
4130 !! result
4131 <div title="&#91;&#91;Main Page]]"></div>
4132
4133 !! end
4134
4135 !! test
4136 Bug 2304: HTML attribute safety (italics)
4137 !! input
4138 <div title="''foobar''"></div>
4139 !! result
4140 <div title="&#39;&#39;foobar&#39;&#39;"></div>
4141
4142 !! end
4143
4144 !! test
4145 Bug 2304: HTML attribute safety (bold)
4146 !! input
4147 <div title="'''foobar'''"></div>
4148 !! result
4149 <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
4150
4151 !! end
4152
4153
4154 !! test
4155 Bug 2304: HTML attribute safety (ISBN)
4156 !! input
4157 <div title="ISBN 1234567890"></div>
4158 !! result
4159 <div title="&#73;SBN 1234567890"></div>
4160
4161 !! end
4162
4163 !! test
4164 Bug 2304: HTML attribute safety (RFC)
4165 !! input
4166 <div title="RFC 1234"></div>
4167 !! result
4168 <div title="&#82;FC 1234"></div>
4169
4170 !! end
4171
4172 !! test
4173 Bug 2304: HTML attribute safety (PMID)
4174 !! input
4175 <div title="PMID 1234567890"></div>
4176 !! result
4177 <div title="&#80;MID 1234567890"></div>
4178
4179 !! end
4180
4181 !! test
4182 Bug 2304: HTML attribute safety (web link)
4183 !! input
4184 <div title="http://example.com/"></div>
4185 !! result
4186 <div title="http&#58;//example.com/"></div>
4187
4188 !! end
4189
4190 !! test
4191 Bug 2304: HTML attribute safety (named web link)
4192 !! input
4193 <div title="[http://example.com/ link]"></div>
4194 !! result
4195 <div title="&#91;http&#58;//example.com/ link]"></div>
4196
4197 !! end
4198
4199 !! test
4200 Bug 3244: HTML attribute safety (extension; safe)
4201 !! input
4202 <div style="<nowiki>background:blue</nowiki>"></div>
4203 !! result
4204 <div style="background:blue"></div>
4205
4206 !! end
4207
4208 !! test
4209 Bug 3244: HTML attribute safety (extension; unsafe)
4210 !! input
4211 <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
4212 !! result
4213 <div></div>
4214
4215 !! end
4216
4217 !! test
4218 Math section safety when disabled
4219 !! input
4220 <math><script>alert(document.cookies);</script></math>
4221 !! result
4222 <p>&lt;math&gt;&lt;script&gt;alert(document.cookies);&lt;/script&gt;&lt;/math&gt;
4223 </p>
4224 !! end
4225
4226 # More MSIE fun discovered by Tom Gilder
4227
4228 !! test
4229 MSIE CSS safety test: spurious slash
4230 !! input
4231 <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
4232 !! result
4233 <div>evil</div>
4234
4235 !! end
4236
4237 !! test
4238 MSIE CSS safety test: hex code
4239 !! input
4240 <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
4241 !! result
4242 <div>evil</div>
4243
4244 !! end
4245
4246 !! test
4247 MSIE CSS safety test: comment in url
4248 !! input
4249 <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
4250 !! result
4251 <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
4252
4253 !! end
4254
4255 !! test
4256 MSIE CSS safety test: comment in expression
4257 !! input
4258 <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
4259 !! result
4260 <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
4261
4262 !! end
4263
4264
4265 !! test
4266 Table attribute legitimate extension
4267 !! input
4268 {|
4269 !+ style="<nowiki>color:blue</nowiki>"| status
4270 |}
4271 !! result
4272 <table>
4273 <tr>
4274 <th style="color:blue"> status
4275 </th></tr></table>
4276
4277 !!end
4278
4279 !! test
4280 Table attribute safety
4281 !! input
4282 {|
4283 !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"| status
4284 |}
4285 !! result
4286 <table>
4287 <tr>
4288 <th> status
4289 </th></tr></table>
4290
4291 !! end
4292
4293
4294 !! article
4295 Template:Identity
4296 !! text
4297 {{{1}}}
4298 !! endarticle
4299
4300 !! test
4301 Expansion of multi-line templates in attribute values (bug 6255)
4302 !! input
4303 <div style="background: {{identity|#00FF00}}">-</div>
4304 !! result
4305 <div style="background: #00FF00">-</div>
4306
4307 !! end
4308
4309
4310 !! test
4311 Expansion of multi-line templates in attribute values (bug 6255 sanity check)
4312 !! input
4313 <div style="background:
4314 #00FF00">-</div>
4315 !! result
4316 <div style="background: #00FF00">-</div>
4317
4318 !! end
4319
4320 !! test
4321 Expansion of multi-line templates in attribute values (bug 6255 sanity check 2)
4322 !! input
4323 <div style="background: &#10;#00FF00">-</div>
4324 !! result
4325 <div style="background: &#10;#00FF00">-</div>
4326
4327 !! end
4328
4329 ###
4330 ### Parser hooks (see maintenance/parserTestsParserHook.php for the <tag> extension)
4331 ###
4332 !! test
4333 Parser hook: empty input
4334 !! input
4335 <tag></tag>
4336 !! result
4337 <pre>
4338 string(0) ""
4339 array(0) {
4340 }
4341 </pre>
4342
4343 !! end
4344
4345 !! test
4346 Parser hook: empty input using terminated empty elements
4347 !! input
4348 <tag/>
4349 !! result
4350 <pre>
4351 NULL
4352 array(0) {
4353 }
4354 </pre>
4355
4356 !! end
4357
4358 !! test
4359 Parser hook: empty input using terminated empty elements (space before)
4360 !! input
4361 <tag />
4362 !! result
4363 <pre>
4364 NULL
4365 array(0) {
4366 }
4367 </pre>
4368
4369 !! end
4370
4371 !! test
4372 Parser hook: basic input
4373 !! input
4374 <tag>input</tag>
4375 !! result
4376 <pre>
4377 string(5) "input"
4378 array(0) {
4379 }
4380 </pre>
4381
4382 !! end
4383
4384
4385 !! test
4386 Parser hook: case insensitive
4387 !! input
4388 <TAG>input</TAG>
4389 !! result
4390 <pre>
4391 string(5) "input"
4392 array(0) {
4393 }
4394 </pre>
4395
4396 !! end
4397
4398
4399 !! test
4400 Parser hook: case insensitive, redux
4401 !! input
4402 <TaG>input</TAg>
4403 !! result
4404 <pre>
4405 string(5) "input"
4406 array(0) {
4407 }
4408 </pre>
4409
4410 !! end
4411
4412 !! test
4413 Parser hook: nested tags
4414 !! options
4415 noxml
4416 !! input
4417 <tag><tag></tag></tag>
4418 !! result
4419 <pre>
4420 string(5) "<tag>"
4421 array(0) {
4422 }
4423 </pre>&lt;/tag&gt;
4424
4425 !! end
4426
4427 !! test
4428 Parser hook: basic arguments
4429 !! input
4430 <tag width=200 height = "100" depth = '50' square></tag>
4431 !! result
4432 <pre>
4433 string(0) ""
4434 array(4) {
4435 ["width"]=>
4436 string(3) "200"
4437 ["height"]=>
4438 string(3) "100"
4439 ["depth"]=>
4440 string(2) "50"
4441 ["square"]=>
4442 string(6) "square"
4443 }
4444 </pre>
4445
4446 !! end
4447
4448 !! test
4449 Parser hook: argument containing a forward slash (bug 5344)
4450 !! input
4451 <tag filename='/tmp/bla'></tag>
4452 !! result
4453 <pre>
4454 string(0) ""
4455 array(1) {
4456 ["filename"]=>
4457 string(8) "/tmp/bla"
4458 }
4459 </pre>
4460
4461 !! end
4462
4463 !! test
4464 Parser hook: empty input using terminated empty elements (bug 2374)
4465 !! input
4466 <tag foo=bar/>text
4467 !! result
4468 <pre>
4469 NULL
4470 array(1) {
4471 ["foo"]=>
4472 string(3) "bar"
4473 }
4474 </pre>text
4475
4476 !! end
4477
4478 # </tag> should be output literally since there is no matching tag that begins it
4479 !! test
4480 Parser hook: basic arguments using terminated empty elements (bug 2374)
4481 !! input
4482 <tag width=200 height = "100" depth = '50' square/>
4483 other stuff
4484 </tag>
4485 !! result
4486 <pre>
4487 NULL
4488 array(4) {
4489 ["width"]=>
4490 string(3) "200"
4491 ["height"]=>
4492 string(3) "100"
4493 ["depth"]=>
4494 string(2) "50"
4495 ["square"]=>
4496 string(6) "square"
4497 }
4498 </pre>
4499 <p>other stuff
4500 &lt;/tag&gt;
4501 </p>
4502 !! end
4503
4504 ###
4505 ### (see maintenance/parserTestsStaticParserHook.php for the <statictag> extension)
4506 ###
4507
4508 !! test
4509 Parser hook: static parser hook not inside a comment
4510 !! input
4511 <statictag>hello, world</statictag>
4512 <statictag action=flush/>
4513 !! result
4514 <p>hello, world
4515 </p>
4516 !! end
4517
4518
4519 !! test
4520 Parser hook: static parser hook inside a comment
4521 !! input
4522 <!-- <statictag>hello, world</statictag> -->
4523 <statictag action=flush/>
4524 !! result
4525 <p><br />
4526 </p>
4527 !! end
4528
4529 # Nested template calls; this case was broken by Parser.php rev 1.506,
4530 # since reverted.
4531
4532 !! article
4533 Template:One-parameter
4534 !! text
4535 (My parameter is: {{{1}}})
4536 !! endarticle
4537
4538 !! article
4539 Template:Map-one-parameter
4540 !! text
4541 {{{{{1}}}|{{{2}}}}}
4542 !! endarticle
4543
4544 !! test
4545 Nested template calls
4546 !! input
4547 {{Map-one-parameter|One-parameter|param}}
4548 !! result
4549 <p>(My parameter is: param)
4550 </p>
4551 !! end
4552
4553
4554 ###
4555 ### Sanitizer
4556 ###
4557 !! test
4558 Sanitizer: Closing of open tags
4559 !! input
4560 <s></s><table></table>
4561 !! result
4562 <s></s><table></table>
4563
4564 !! end
4565
4566 !! test
4567 Sanitizer: Closing of open but not closed tags
4568 !! input
4569 <s>foo
4570 !! result
4571 <p><s>foo</s>
4572 </p>
4573 !! end
4574
4575 !! test
4576 Sanitizer: Closing of closed but not open tags
4577 !! input
4578 </s>
4579 !! result
4580 <p>&lt;/s&gt;
4581 </p>
4582 !! end
4583
4584 !! test
4585 Sanitizer: Closing of closed but not open table tags
4586 !! input
4587 Table not started</td></tr></table>
4588 !! result
4589 <p>Table not started&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
4590 </p>
4591 !! end
4592
4593 !! test
4594 Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
4595 !! input
4596 <span id="æ: v">byte</span>[[#æ: v|backlink]]
4597 !! result
4598 <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v" title="">backlink</a>
4599 </p>
4600 !! end
4601
4602 !! test
4603 Sanitizer: Validating the contents of the id attribute (bug 4515)
4604 !! options
4605 disabled
4606 !! input
4607 <br id=9 />
4608 !! result
4609 Something, but defenetly not <br id="9" />...
4610 !! end
4611
4612 !! test
4613 Sanitizer: Validating id attribute uniqueness (bug 4515, bug 6301)
4614 !! options
4615 disabled
4616 !! input
4617 <br id="foo" /><br id="foo" />
4618 !! result
4619 Something need to be done. foo-2 ?
4620 !! end
4621
4622 !! test
4623 Language converter: output gets cut off unexpectedly (bug 5757)
4624 !! options
4625 language=zh
4626 !! input
4627 this bit is safe: }-
4628
4629 but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
4630
4631 then we get cut off here: }-
4632
4633 all additional text is vanished
4634 !! result
4635 <p>this bit is safe: }-
4636 </p><p>but if we add a conversion instance: xxx
4637 </p><p>then we get cut off here: }-
4638 </p><p>all additional text is vanished
4639 </p>
4640 !! end
4641
4642 !! test
4643 Self closed html pairs (bug 5487)
4644 !! options
4645 !! input
4646 <center><font id="bug" />Centered text</center>
4647 <div><font id="bug2" />In div text</div>
4648 !! result
4649 <center>&lt;font id="bug" /&gt;Centered text</center>
4650 <div>&lt;font id="bug2" /&gt;In div text</div>
4651
4652 !! end
4653
4654 #
4655 #
4656 #
4657
4658 !! test
4659 Punctuation: nbsp before exclamation
4660 !! input
4661 C'est grave !
4662 !! result
4663 <p>C'est grave&nbsp;!
4664 </p>
4665 !! end
4666
4667 !! test
4668 Punctuation: CSS !important (bug 11874)
4669 !! input
4670 <div style="width:50% !important">important</div>
4671 !! result
4672 <div style="width:50% !important">important</div>
4673
4674 !!end
4675
4676 !! test
4677 Punctuation: CSS ! important (bug 11874; with space after)
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
4686 !! test
4687 HTML bullet list, closed tags (bug 5497)
4688 !! input
4689 <ul>
4690 <li>One</li>
4691 <li>Two</li>
4692 </ul>
4693 !! result
4694 <ul>
4695 <li>One</li>
4696 <li>Two</li>
4697 </ul>
4698
4699 !! end
4700
4701 !! test
4702 HTML bullet list, unclosed tags (bug 5497)
4703 !! input
4704 <ul>
4705 <li>One
4706 <li>Two
4707 </ul>
4708 !! result
4709 <ul>
4710 <li>One
4711 </li><li>Two
4712 </li></ul>
4713
4714 !! end
4715
4716 !! test
4717 HTML ordered list, closed tags (bug 5497)
4718 !! input
4719 <ol>
4720 <li>One</li>
4721 <li>Two</li>
4722 </ol>
4723 !! result
4724 <ol>
4725 <li>One</li>
4726 <li>Two</li>
4727 </ol>
4728
4729 !! end
4730
4731 !! test
4732 HTML ordered list, unclosed tags (bug 5497)
4733 !! input
4734 <ol>
4735 <li>One
4736 <li>Two
4737 </ol>
4738 !! result
4739 <ol>
4740 <li>One
4741 </li><li>Two
4742 </li></ol>
4743
4744 !! end
4745
4746 !! test
4747 HTML nested bullet list, closed tags (bug 5497)
4748 !! input
4749 <ul>
4750 <li>One</li>
4751 <li>Two:
4752 <ul>
4753 <li>Sub-one</li>
4754 <li>Sub-two</li>
4755 </ul>
4756 </li>
4757 </ul>
4758 !! result
4759 <ul>
4760 <li>One</li>
4761 <li>Two:
4762 <ul>
4763 <li>Sub-one</li>
4764 <li>Sub-two</li>
4765 </ul>
4766 </li>
4767 </ul>
4768
4769 !! end
4770
4771 !! test
4772 HTML nested bullet list, open tags (bug 5497)
4773 !! input
4774 <ul>
4775 <li>One
4776 <li>Two:
4777 <ul>
4778 <li>Sub-one
4779 <li>Sub-two
4780 </ul>
4781 </ul>
4782 !! result
4783 <ul>
4784 <li>One
4785 </li><li>Two:
4786 <ul>
4787 <li>Sub-one
4788 </li><li>Sub-two
4789 </li></ul>
4790 </li></ul>
4791
4792 !! end
4793
4794 !! test
4795 HTML nested ordered list, closed tags (bug 5497)
4796 !! input
4797 <ol>
4798 <li>One</li>
4799 <li>Two:
4800 <ol>
4801 <li>Sub-one</li>
4802 <li>Sub-two</li>
4803 </ol>
4804 </li>
4805 </ol>
4806 !! result
4807 <ol>
4808 <li>One</li>
4809 <li>Two:
4810 <ol>
4811 <li>Sub-one</li>
4812 <li>Sub-two</li>
4813 </ol>
4814 </li>
4815 </ol>
4816
4817 !! end
4818
4819 !! test
4820 HTML nested ordered list, open tags (bug 5497)
4821 !! input
4822 <ol>
4823 <li>One
4824 <li>Two:
4825 <ol>
4826 <li>Sub-one
4827 <li>Sub-two
4828 </ol>
4829 </ol>
4830 !! result
4831 <ol>
4832 <li>One
4833 </li><li>Two:
4834 <ol>
4835 <li>Sub-one
4836 </li><li>Sub-two
4837 </li></ol>
4838 </li></ol>
4839
4840 !! end
4841
4842 !! test
4843 HTML ordered list item with parameters oddity
4844 !! input
4845 <ol><li id="fragment">One</li></ol>
4846 !! result
4847 <ol><li id="fragment">One</li></ol>
4848
4849 !! end
4850
4851 !!test
4852 bug 5918: autonumbering
4853 !! input
4854 [http://first/] [http://second] [ftp://ftp]
4855
4856 ftp://inlineftp
4857
4858 [mailto:enclosed@mail.tld With target]
4859
4860 [mailto:enclosed@mail.tld]
4861
4862 mailto:inline@mail.tld
4863 !! result
4864 <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>
4865 </p><p><a href="ftp://inlineftp" class="external free" title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
4866 </p><p><a href="mailto:enclosed@mail.tld" class="external text" title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
4867 </p><p><a href="mailto:enclosed@mail.tld" class="external autonumber" title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
4868 </p><p><a href="mailto:inline@mail.tld" class="external free" title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
4869 </p>
4870 !! end
4871
4872
4873 #
4874 # Security and HTML correctness
4875 # From Nick Jenkins' fuzz testing
4876 #
4877
4878 !! test
4879 Fuzz testing: Parser13
4880 !! input
4881 {|
4882 | http://a|
4883 !! result
4884 <table>
4885 <tr>
4886 <td>
4887 </td>
4888 </tr>
4889 </table>
4890
4891 !! end
4892
4893 !! test
4894 Fuzz testing: Parser14
4895 !! input
4896 == onmouseover= ==
4897 http://__TOC__
4898 !! result
4899 <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>
4900 http://<table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
4901 <ul>
4902 <li class="toclevel-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
4903 </ul>
4904 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
4905
4906 !! end
4907
4908 !! test
4909 Fuzz testing: Parser14-table
4910 !! input
4911 ==a==
4912 {| STYLE=__TOC__
4913 !! result
4914 <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>
4915 <table style="&#95;_TOC&#95;_">
4916 <tr><td></td></tr>
4917 </table>
4918
4919 !! end
4920
4921 # Known to produce bogus xml (extra </td>)
4922 !! test
4923 Fuzz testing: Parser16
4924 !! options
4925 noxml
4926 !! input
4927 {|
4928 !https://||||||
4929 !! result
4930 <table>
4931 <tr>
4932 <th>https://</th><th></th><th></th><th>
4933 </td>
4934 </tr>
4935 </table>
4936
4937 !! end
4938
4939 !! test
4940 Fuzz testing: Parser21
4941 !! input
4942 {|
4943 ! irc://{{ftp://a" onmouseover="alert('hello world');"
4944 |
4945 !! result
4946 <table>
4947 <tr>
4948 <th> <a href="irc://{{ftp://a" class="external free" title="irc://{{ftp://a" rel="nofollow">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
4949 </th><td>
4950 </td>
4951 </tr>
4952 </table>
4953
4954 !! end
4955
4956 !! test
4957 Fuzz testing: Parser22
4958 !! input
4959 http://===r:::https://b
4960
4961 {|
4962 !!result
4963 <p><a href="http://===r:::https://b" class="external free" title="http://===r:::https://b" rel="nofollow">http://===r:::https://b</a>
4964 </p>
4965 <table>
4966 <tr><td></td></tr>
4967 </table>
4968
4969 !! end
4970
4971 # Known to produce bad XML for now
4972 !! test
4973 Fuzz testing: Parser24
4974 !! options
4975 noxml
4976 !! input
4977 {|
4978 {{{|
4979 <u CLASS=
4980 | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
4981 <br style="onmouseover='alert(document.cookie);' " />
4982
4983 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4984 |
4985 !! result
4986 <table>
4987 {{{|
4988 <u class="&#124;">}}}} &gt;
4989 <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
4990
4991 MOVE YOUR MOUSE CURSOR OVER THIS TEXT
4992 <tr>
4993 <td></u>
4994 </td>
4995 </tr>
4996 </table>
4997
4998 !! end
4999
5000 # Note: the current result listed for this is not what the original one was,
5001 # but the original bug was JavaScript injection, which is fixed in any case.
5002 # It's not clear that the original result listed was any more correct than the
5003 # current one. Original result:
5004 # <p>{{{|
5005 # </p>
5006 # <li class="&#124;&#124;">
5007 # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5008 !!test
5009 Fuzz testing: Parser25 (bug 6055)
5010 !! input
5011 {{{
5012 |
5013 <LI CLASS=||
5014 >
5015 }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
5016 !! result
5017 <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
5018 </p>
5019 !! end
5020
5021 !!test
5022 Fuzz testing: URL adjacent extension (with space, clean)
5023 !! options
5024 !! input
5025 http://example.com <nowiki>junk</nowiki>
5026 !! result
5027 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a> junk
5028 </p>
5029 !!end
5030
5031 !!test
5032 Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
5033 !! options
5034 !! input
5035 http://example.com<nowiki>junk</nowiki>
5036 !! result
5037 <p><a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a>junk
5038 </p>
5039 !!end
5040
5041 !!test
5042 Fuzz testing: URL adjacent extension (no space, dirty; pre)
5043 !! options
5044 !! input
5045 http://example.com<pre>junk</pre>
5046 !! result
5047 <a href="http://example.com" class="external free" title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
5048
5049 !!end
5050
5051 !!test
5052 Fuzz testing: image with bogus manual thumbnail
5053 !!input
5054 [[Image:foobar.jpg|thumbnail= ]]
5055 !!result
5056 <div class="thumb tright"><div class="thumbinner" style="width:1943px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
5057
5058 !!end
5059
5060 !! test
5061 Fuzz testing: encoded newline in generated HTML replacements (bug 6577)
5062 !! input
5063 <pre dir="&#10;"></pre>
5064 !! result
5065 <pre dir="&#10;"></pre>
5066
5067 !! end
5068
5069 !! test
5070 Parsing optional HTML elements (Bug 6171)
5071 !! options
5072 !! input
5073 <table>
5074 <tr>
5075 <td> Some tabular data</td>
5076 <td> More tabular data ...
5077 <td> And yet som tabular data</td>
5078 </tr>
5079 </table>
5080 !! result
5081 <table>
5082 <tr>
5083 <td> Some tabular data</td>
5084 <td> More tabular data ...
5085 </td><td> And yet som tabular data</td>
5086 </tr>
5087 </table>
5088
5089 !! end
5090
5091 !! test
5092 Correct handling of <td>, <tr> (Bug 6171)
5093 !! options
5094 !! input
5095 <table>
5096 <tr>
5097 <td> Some tabular data</td>
5098 <td> More tabular data ...</td>
5099 <td> And yet som tabular data</td>
5100 </tr>
5101 </table>
5102 !! result
5103 <table>
5104 <tr>
5105 <td> Some tabular data</td>
5106 <td> More tabular data ...</td>
5107 <td> And yet som tabular data</td>
5108 </tr>
5109 </table>
5110
5111 !! end
5112
5113
5114 !! test
5115 Parsing crashing regression (fr:JavaScript)
5116 !! input
5117 </body></x>
5118 !! result
5119 <p>&lt;/body&gt;&lt;/x&gt;
5120 </p>
5121 !! end
5122
5123 !! test
5124 Inline wiki vs wiki block nesting
5125 !! input
5126 '''Bold paragraph
5127
5128 New wiki paragraph
5129 !! result
5130 <p><b>Bold paragraph</b>
5131 </p><p>New wiki paragraph
5132 </p>
5133 !! end
5134
5135 !! test
5136 Inline HTML vs wiki block nesting
5137 !! input
5138 <b>Bold paragraph
5139
5140 New wiki paragraph
5141 !! result
5142 <p><b>Bold paragraph</b>
5143 </p><p>New wiki paragraph
5144 </p>
5145 !! end
5146
5147 # Original result was this:
5148 # <p><b>bold</b><b>bold<i>bolditalics</i></b>
5149 # </p>
5150 # While that might be marginally more intuitive, maybe, the six-apostrophe
5151 # construct is clearly pathological and the result stated here (which is what
5152 # the parser actually does) is about as reasonable as anything.
5153 !!test
5154 Mixing markup for italics and bold
5155 !! options
5156 !! input
5157 '''bold''''''bold''bolditalics'''''
5158 !! result
5159 <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
5160 </p>
5161 !! end
5162
5163
5164 !! article
5165 Xyzzyx
5166 !! text
5167 Article for special page transclusion test
5168 !! endarticle
5169
5170 !! test
5171 Special page transclusion
5172 !! options
5173 !! input
5174 {{Special:Prefixindex/Xyzzyx}}
5175 !! result
5176 <p><br />
5177 </p>
5178 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5179
5180 !! end
5181
5182 !! test
5183 Special page transclusion twice (bug 5021)
5184 !! options
5185 !! input
5186 {{Special:Prefixindex/Xyzzyx}}
5187 {{Special:Prefixindex/Xyzzyx}}
5188 !! result
5189 <p><br />
5190 </p>
5191 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5192 <p><br />
5193 </p>
5194 <table style="background: inherit;" border="0" width="100%"><tr><td><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></td></tr></table>
5195
5196 !! end
5197
5198 !! test
5199 Transclusion of default MediaWiki message
5200 !! input
5201 {{MediaWiki:Mainpage}}
5202 !!result
5203 <p>Main Page
5204 </p>
5205 !! end
5206
5207 !! test
5208 Transclusion of nonexistent MediaWiki message
5209 !! input
5210 {{MediaWiki:Mainpagexxx}}
5211 !!result
5212 <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>
5213 </p>
5214 !! end
5215
5216 !! test
5217 Transclusion of MediaWiki message with underscore
5218 !! input
5219 {{MediaWiki:history_short}}
5220 !! result
5221 <p>History
5222 </p>
5223 !! end
5224
5225 !! test
5226 Transclusion of MediaWiki message with space
5227 !! input
5228 {{MediaWiki:history short}}
5229 !! result
5230 <p>History
5231 </p>
5232 !! end
5233
5234 !! test
5235 Invalid header with following text
5236 !! input
5237 = x = y
5238 !! result
5239 <p>= x = y
5240 </p>
5241 !! end
5242
5243
5244 !! test
5245 Section extraction test (section 0)
5246 !! options
5247 section=0
5248 !! input
5249 start
5250 ==a==
5251 ===aa===
5252 ====aaa====
5253 ==b==
5254 ===ba===
5255 ===bb===
5256 ====bba====
5257 ===bc===
5258 ==c==
5259 ===ca===
5260 !! result
5261 start
5262 !! end
5263
5264 !! test
5265 Section extraction test (section 1)
5266 !! options
5267 section=1
5268 !! input
5269 start
5270 ==a==
5271 ===aa===
5272 ====aaa====
5273 ==b==
5274 ===ba===
5275 ===bb===
5276 ====bba====
5277 ===bc===
5278 ==c==
5279 ===ca===
5280 !! result
5281 ==a==
5282 ===aa===
5283 ====aaa====
5284 !! end
5285
5286 !! test
5287 Section extraction test (section 2)
5288 !! options
5289 section=2
5290 !! input
5291 start
5292 ==a==
5293 ===aa===
5294 ====aaa====
5295 ==b==
5296 ===ba===
5297 ===bb===
5298 ====bba====
5299 ===bc===
5300 ==c==
5301 ===ca===
5302 !! result
5303 ===aa===
5304 ====aaa====
5305 !! end
5306
5307 !! test
5308 Section extraction test (section 3)
5309 !! options
5310 section=3
5311 !! input
5312 start
5313 ==a==
5314 ===aa===
5315 ====aaa====
5316 ==b==
5317 ===ba===
5318 ===bb===
5319 ====bba====
5320 ===bc===
5321 ==c==
5322 ===ca===
5323 !! result
5324 ====aaa====
5325 !! end
5326
5327 !! test
5328 Section extraction test (section 4)
5329 !! options
5330 section=4
5331 !! input
5332 start
5333 ==a==
5334 ===aa===
5335 ====aaa====
5336 ==b==
5337 ===ba===
5338 ===bb===
5339 ====bba====
5340 ===bc===
5341 ==c==
5342 ===ca===
5343 !! result
5344 ==b==
5345 ===ba===
5346 ===bb===
5347 ====bba====
5348 ===bc===
5349 !! end
5350
5351 !! test
5352 Section extraction test (section 5)
5353 !! options
5354 section=5
5355 !! input
5356 start
5357 ==a==
5358 ===aa===
5359 ====aaa====
5360 ==b==
5361 ===ba===
5362 ===bb===
5363 ====bba====
5364 ===bc===
5365 ==c==
5366 ===ca===
5367 !! result
5368 ===ba===
5369 !! end
5370
5371 !! test
5372 Section extraction test (section 6)
5373 !! options
5374 section=6
5375 !! input
5376 start
5377 ==a==
5378 ===aa===
5379 ====aaa====
5380 ==b==
5381 ===ba===
5382 ===bb===
5383 ====bba====
5384 ===bc===
5385 ==c==
5386 ===ca===
5387 !! result
5388 ===bb===
5389 ====bba====
5390 !! end
5391
5392 !! test
5393 Section extraction test (section 7)
5394 !! options
5395 section=7
5396 !! input
5397 start
5398 ==a==
5399 ===aa===
5400 ====aaa====
5401 ==b==
5402 ===ba===
5403 ===bb===
5404 ====bba====
5405 ===bc===
5406 ==c==
5407 ===ca===
5408 !! result
5409 ====bba====
5410 !! end
5411
5412 !! test
5413 Section extraction test (section 8)
5414 !! options
5415 section=8
5416 !! input
5417 start
5418 ==a==
5419 ===aa===
5420 ====aaa====
5421 ==b==
5422 ===ba===
5423 ===bb===
5424 ====bba====
5425 ===bc===
5426 ==c==
5427 ===ca===
5428 !! result
5429 ===bc===
5430 !! end
5431
5432 !! test
5433 Section extraction test (section 9)
5434 !! options
5435 section=9
5436 !! input
5437 start
5438 ==a==
5439 ===aa===
5440 ====aaa====
5441 ==b==
5442 ===ba===
5443 ===bb===
5444 ====bba====
5445 ===bc===
5446 ==c==
5447 ===ca===
5448 !! result
5449 ==c==
5450 ===ca===
5451 !! end
5452
5453 !! test
5454 Section extraction test (section 10)
5455 !! options
5456 section=10
5457 !! input
5458 start
5459 ==a==
5460 ===aa===
5461 ====aaa====
5462 ==b==
5463 ===ba===
5464 ===bb===
5465 ====bba====
5466 ===bc===
5467 ==c==
5468 ===ca===
5469 !! result
5470 ===ca===
5471 !! end
5472
5473 !! test
5474 Section extraction test (nonexistent section 11)
5475 !! options
5476 section=11
5477 !! input
5478 start
5479 ==a==
5480 ===aa===
5481 ====aaa====
5482 ==b==
5483 ===ba===
5484 ===bb===
5485 ====bba====
5486 ===bc===
5487 ==c==
5488 ===ca===
5489 !! result
5490 !! end
5491
5492 !! test
5493 Section extraction test with bogus heading (section 1)
5494 !! options
5495 section=1
5496 !! input
5497 ==a==
5498 ==bogus== not a legal section
5499 ==b==
5500 !! result
5501 ==a==
5502 ==bogus== not a legal section
5503 !! end
5504
5505 !! test
5506 Section extraction test with bogus heading (section 2)
5507 !! options
5508 section=2
5509 !! input
5510 ==a==
5511 ==bogus== not a legal section
5512 ==b==
5513 !! result
5514 ==b==
5515 !! end
5516
5517 !! test
5518 Section extraction test with comment after heading (section 1)
5519 !! options
5520 section=1
5521 !! input
5522 ==a==
5523 ==b== <!-- -->
5524 ==c==
5525 !! result
5526 ==a==
5527 !! end
5528
5529 !! test
5530 Section extraction test with comment after heading (section 2)
5531 !! options
5532 section=2
5533 !! input
5534 ==a==
5535 ==b== <!-- -->
5536 ==c==
5537 !! result
5538 ==b== <!-- -->
5539 !! end
5540
5541 !! test
5542 Section extraction test with bogus <nowiki> heading (section 1)
5543 !! options
5544 section=1
5545 !! input
5546 ==a==
5547 ==bogus== <nowiki>not a legal section</nowiki>
5548 ==b==
5549 !! result
5550 ==a==
5551 ==bogus== <nowiki>not a legal section</nowiki>
5552 !! end
5553
5554 !! test
5555 Section extraction test with bogus <nowiki> heading (section 2)
5556 !! options
5557 section=2
5558 !! input
5559 ==a==
5560 ==bogus== <nowiki>not a legal section</nowiki>
5561 ==b==
5562 !! result
5563 ==b==
5564 !! end
5565
5566
5567 # Formerly testing for bug 2587, now resolved by the use of unmarked sections
5568 # instead of respecting commented sections
5569 !! test
5570 Section extraction prefixed by comment (section 1)
5571 !! options
5572 section=1
5573 !! input
5574 <!-- -->==sec1==
5575 ==sec2==
5576 !!result
5577 ==sec2==
5578 !!end
5579
5580 !! test
5581 Section extraction prefixed by comment (section 2)
5582 !! options
5583 section=2
5584 !! input
5585 <!-- -->==sec1==
5586 ==sec2==
5587 !!result
5588
5589 !!end
5590
5591
5592 # Formerly testing for bug 2607, now resolved by the use of unmarked sections
5593 # instead of respecting HTML-style headings
5594 !! test
5595 Section extraction, mixed wiki and html (section 1)
5596 !! options
5597 section=1
5598 !! input
5599 <h2>unmarked</h2>
5600 unmarked
5601 ==1==
5602 one
5603 ==2==
5604 two
5605 !! result
5606 ==1==
5607 one
5608 !! end
5609
5610 !! test
5611 Section extraction, mixed wiki and html (section 2)
5612 !! options
5613 section=2
5614 !! input
5615 <h2>unmarked</h2>
5616 unmarked
5617 ==1==
5618 one
5619 ==2==
5620 two
5621 !! result
5622 ==2==
5623 two
5624 !! end
5625
5626
5627 # Formerly testing for bug 3342
5628 !! test
5629 Section extraction, heading surrounded by <noinclude>
5630 !! options
5631 section=1
5632 !! input
5633 <noinclude>==unmarked==</noinclude>
5634 ==marked==
5635 !! result
5636 ==marked==
5637 !!end
5638
5639
5640 !! test
5641 Section replacement test (section 0)
5642 !! options
5643 replace=0,"xxx"
5644 !! input
5645 start
5646 ==a==
5647 ===aa===
5648 ====aaa====
5649 ==b==
5650 ===ba===
5651 ===bb===
5652 ====bba====
5653 ===bc===
5654 ==c==
5655 ===ca===
5656 !! result
5657 xxx
5658
5659 ==a==
5660 ===aa===
5661 ====aaa====
5662 ==b==
5663 ===ba===
5664 ===bb===
5665 ====bba====
5666 ===bc===
5667 ==c==
5668 ===ca===
5669 !! end
5670
5671 !! test
5672 Section replacement test (section 1)
5673 !! options
5674 replace=1,"xxx"
5675 !! input
5676 start
5677 ==a==
5678 ===aa===
5679 ====aaa====
5680 ==b==
5681 ===ba===
5682 ===bb===
5683 ====bba====
5684 ===bc===
5685 ==c==
5686 ===ca===
5687 !! result
5688 start
5689 xxx
5690
5691 ==b==
5692 ===ba===
5693 ===bb===
5694 ====bba====
5695 ===bc===
5696 ==c==
5697 ===ca===
5698 !! end
5699
5700 !! test
5701 Section replacement test (section 2)
5702 !! options
5703 replace=2,"xxx"
5704 !! input
5705 start
5706 ==a==
5707 ===aa===
5708 ====aaa====
5709 ==b==
5710 ===ba===
5711 ===bb===
5712 ====bba====
5713 ===bc===
5714 ==c==
5715 ===ca===
5716 !! result
5717 start
5718 ==a==
5719 xxx
5720
5721 ==b==
5722 ===ba===
5723 ===bb===
5724 ====bba====
5725 ===bc===
5726 ==c==
5727 ===ca===
5728 !! end
5729
5730 !! test
5731 Section replacement test (section 3)
5732 !! options
5733 replace=3,"xxx"
5734 !! input
5735 start
5736 ==a==
5737 ===aa===
5738 ====aaa====
5739 ==b==
5740 ===ba===
5741 ===bb===
5742 ====bba====
5743 ===bc===
5744 ==c==
5745 ===ca===
5746 !! result
5747 start
5748 ==a==
5749 ===aa===
5750 xxx
5751
5752 ==b==
5753 ===ba===
5754 ===bb===
5755 ====bba====
5756 ===bc===
5757 ==c==
5758 ===ca===
5759 !! end
5760
5761 !! test
5762 Section replacement test (section 4)
5763 !! options
5764 replace=4,"xxx"
5765 !! input
5766 start
5767 ==a==
5768 ===aa===
5769 ====aaa====
5770 ==b==
5771 ===ba===
5772 ===bb===
5773 ====bba====
5774 ===bc===
5775 ==c==
5776 ===ca===
5777 !! result
5778 start
5779 ==a==
5780 ===aa===
5781 ====aaa====
5782 xxx
5783
5784 ==c==
5785 ===ca===
5786 !! end
5787
5788 !! test
5789 Section replacement test (section 5)
5790 !! options
5791 replace=5,"xxx"
5792 !! input
5793 start
5794 ==a==
5795 ===aa===
5796 ====aaa====
5797 ==b==
5798 ===ba===
5799 ===bb===
5800 ====bba====
5801 ===bc===
5802 ==c==
5803 ===ca===
5804 !! result
5805 start
5806 ==a==
5807 ===aa===
5808 ====aaa====
5809 ==b==
5810 xxx
5811
5812 ===bb===
5813 ====bba====
5814 ===bc===
5815 ==c==
5816 ===ca===
5817 !! end
5818
5819 !! test
5820 Section replacement test (section 6)
5821 !! options
5822 replace=6,"xxx"
5823 !! input
5824 start
5825 ==a==
5826 ===aa===
5827 ====aaa====
5828 ==b==
5829 ===ba===
5830 ===bb===
5831 ====bba====
5832 ===bc===
5833 ==c==
5834 ===ca===
5835 !! result
5836 start
5837 ==a==
5838 ===aa===
5839 ====aaa====
5840 ==b==
5841 ===ba===
5842 xxx
5843
5844 ===bc===
5845 ==c==
5846 ===ca===
5847 !! end
5848
5849 !! test
5850 Section replacement test (section 7)
5851 !! options
5852 replace=7,"xxx"
5853 !! input
5854 start
5855 ==a==
5856 ===aa===
5857 ====aaa====
5858 ==b==
5859 ===ba===
5860 ===bb===
5861 ====bba====
5862 ===bc===
5863 ==c==
5864 ===ca===
5865 !! result
5866 start
5867 ==a==
5868 ===aa===
5869 ====aaa====
5870 ==b==
5871 ===ba===
5872 ===bb===
5873 xxx
5874
5875 ===bc===
5876 ==c==
5877 ===ca===
5878 !! end
5879
5880 !! test
5881 Section replacement test (section 8)
5882 !! options
5883 replace=8,"xxx"
5884 !! input
5885 start
5886 ==a==
5887 ===aa===
5888 ====aaa====
5889 ==b==
5890 ===ba===
5891 ===bb===
5892 ====bba====
5893 ===bc===
5894 ==c==
5895 ===ca===
5896 !! result
5897 start
5898 ==a==
5899 ===aa===
5900 ====aaa====
5901 ==b==
5902 ===ba===
5903 ===bb===
5904 ====bba====
5905 xxx
5906
5907 ==c==
5908 ===ca===
5909 !!end
5910
5911 !! test
5912 Section replacement test (section 9)
5913 !! options
5914 replace=9,"xxx"
5915 !! input
5916 start
5917 ==a==
5918 ===aa===
5919 ====aaa====
5920 ==b==
5921 ===ba===
5922 ===bb===
5923 ====bba====
5924 ===bc===
5925 ==c==
5926 ===ca===
5927 !! result
5928 start
5929 ==a==
5930 ===aa===
5931 ====aaa====
5932 ==b==
5933 ===ba===
5934 ===bb===
5935 ====bba====
5936 ===bc===
5937 xxx
5938 !! end
5939
5940 !! test
5941 Section replacement test (section 10)
5942 !! options
5943 replace=10,"xxx"
5944 !! input
5945 start
5946 ==a==
5947 ===aa===
5948 ====aaa====
5949 ==b==
5950 ===ba===
5951 ===bb===
5952 ====bba====
5953 ===bc===
5954 ==c==
5955 ===ca===
5956 !! result
5957 start
5958 ==a==
5959 ===aa===
5960 ====aaa====
5961 ==b==
5962 ===ba===
5963 ===bb===
5964 ====bba====
5965 ===bc===
5966 ==c==
5967 xxx
5968 !! end
5969
5970 !! test
5971 Section replacement test with initial whitespace (bug 13728)
5972 !! options
5973 replace=2,"xxx"
5974 !! input
5975 Preformatted initial line
5976 ==a==
5977 ===a===
5978 !! result
5979 Preformatted initial line
5980 ==a==
5981 xxx
5982 !! end
5983
5984
5985 !! test
5986 Section extraction, heading followed by pre with 20 spaces (bug 6398)
5987 !! options
5988 section=1
5989 !! input
5990 ==a==
5991 a
5992 !! result
5993 ==a==
5994 a
5995 !! end
5996
5997 !! test
5998 Section extraction, heading followed by pre with 19 spaces (bug 6398 sanity check)
5999 !! options
6000 section=1
6001 !! input
6002 ==a==
6003 a
6004 !! result
6005 ==a==
6006 a
6007 !! end
6008
6009
6010 !! test
6011 Section extraction, <pre> around bogus header (bug 10309)
6012 !! options
6013 noxml section=2
6014 !! input
6015 == Section One ==
6016 <pre>
6017 =======
6018 </pre>
6019
6020 == Section Two ==
6021 stuff
6022 !! result
6023 == Section Two ==
6024 stuff
6025 !! end
6026
6027 !! test
6028 Section replacement, <pre> around bogus header (bug 10309)
6029 !! options
6030 noxml replace=2,"xxx"
6031 !! input
6032 == Section One ==
6033 <pre>
6034 =======
6035 </pre>
6036
6037 == Section Two ==
6038 stuff
6039 !! result
6040 == Section One ==
6041 <pre>
6042 =======
6043 </pre>
6044
6045 xxx
6046 !! end
6047
6048
6049
6050 !! test
6051 Handling of &#x0A; in URLs
6052 !! input
6053 **irc://&#x0A;a
6054 !! result
6055 <ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a>
6056 </li></ul>
6057 </li></ul>
6058
6059 !!end
6060
6061 !! test
6062 5 quotes, code coverage +1 line
6063 !! input
6064 '''''
6065 !! result
6066 !! end
6067
6068 !! test
6069 Special:Search page linking.
6070 !! input
6071 {{Special:search}}
6072 !! result
6073 <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
6074 </p>
6075 !! end
6076
6077 !! test
6078 Say the magic word
6079 !! input
6080 * {{PAGENAME}}
6081 * {{BASEPAGENAME}}
6082 * {{SUBPAGENAME}}
6083 * {{SUBPAGENAMEE}}
6084 * {{BASEPAGENAME}}
6085 * {{BASEPAGENAMEE}}
6086 * {{TALKPAGENAME}}
6087 * {{TALKPAGENAMEE}}
6088 * {{SUBJECTPAGENAME}}
6089 * {{SUBJECTPAGENAMEE}}
6090 * {{NAMESPACEE}}
6091 * {{NAMESPACE}}
6092 * {{TALKSPACE}}
6093 * {{TALKSPACEE}}
6094 * {{SUBJECTSPACE}}
6095 * {{SUBJECTSPACEE}}
6096 * {{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
6097 !! result
6098 <ul><li> Parser test
6099 </li><li> Parser test
6100 </li><li> Parser test
6101 </li><li> Parser_test
6102 </li><li> Parser test
6103 </li><li> Parser_test
6104 </li><li> Talk:Parser test
6105 </li><li> Talk:Parser_test
6106 </li><li> Parser test
6107 </li><li> Parser_test
6108 </li><li>
6109 </li><li>
6110 </li><li> Talk
6111 </li><li> Talk
6112 </li><li>
6113 </li><li>
6114 </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>
6115 </li></ul>
6116
6117 !! end
6118 ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
6119
6120 !! test
6121 Gallery
6122 !! input
6123 <gallery>
6124 image1.png |
6125 image2.gif|||||
6126
6127 image3|
6128 image4 |300px| centre
6129 image5.svg| http://///////
6130 [[x|xx]]]]
6131 * image6
6132 </gallery>
6133 !! result
6134 <table class="gallery" cellspacing="0" cellpadding="0">
6135 <tr>
6136 <td><div class="gallerybox" style="width: 155px;">
6137 <div style="height: 152px;">Image1.png</div>
6138 <div class="gallerytext">
6139 </div>
6140 </div></td>
6141 <td><div class="gallerybox" style="width: 155px;">
6142 <div style="height: 152px;">Image2.gif</div>
6143 <div class="gallerytext">
6144 <p>||||
6145 </p>
6146 </div>
6147 </div></td>
6148 <td><div class="gallerybox" style="width: 155px;">
6149 <div style="height: 152px;">Image3</div>
6150 <div class="gallerytext">
6151 </div>
6152 </div></td>
6153 <td><div class="gallerybox" style="width: 155px;">
6154 <div style="height: 152px;">Image4</div>
6155 <div class="gallerytext">
6156 <p>300px| centre
6157 </p>
6158 </div>
6159 </div></td>
6160 </tr>
6161 <tr>
6162 <td><div class="gallerybox" style="width: 155px;">
6163 <div style="height: 152px;">Image5.svg</div>
6164 <div class="gallerytext">
6165 <p><a href="http://///////" class="external free" title="http://///////" rel="nofollow">http://///////</a>
6166 </p>
6167 </div>
6168 </div></td>
6169 <td><div class="gallerybox" style="width: 155px;">
6170 <div style="height: 152px;">* image6</div>
6171 <div class="gallerytext">
6172 </div>
6173 </div></td>
6174 </tr>
6175 </table>
6176
6177 !! end
6178
6179 !! test
6180 HTML Hex character encoding (spells the word "JavaScript")
6181 !! input
6182 &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
6183 !! result
6184 <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
6185 </p>
6186 !! end
6187
6188 !! test
6189 __FORCETOC__ override
6190 !! input
6191 __NEWSECTIONLINK__
6192 __FORCETOC__
6193 !! result
6194 <p><br />
6195 </p>
6196 !! end
6197
6198 !! test
6199 ISBN code coverage
6200 !! input
6201 ISBN 978-0-1234-56&#x20;789
6202 !! result
6203 <p><a href="/wiki/Special:BookSources/9780123456" class="internal">ISBN 978-0-1234-56</a>&#x20;789
6204 </p>
6205 !! end
6206
6207 !! test
6208 ISBN followed by 5 spaces
6209 !! input
6210 ISBN
6211 !! result
6212 <p>ISBN
6213 </p>
6214 !! end
6215
6216 !! test
6217 Double ISBN
6218 !! input
6219 ISBN ISBN 1234567890
6220 !! result
6221 <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6222 </p>
6223 !! end
6224
6225 !! test
6226 Double RFC
6227 !! input
6228 RFC RFC 1234
6229 !! result
6230 <p>RFC <a href="http://tools.ietf.org/html/rfc1234" class="external" title="http://tools.ietf.org/html/rfc1234">RFC 1234</a>
6231 </p>
6232 !! end
6233
6234 !! test
6235 Double RFC with a wiki link
6236 !! input
6237 RFC [[RFC 1234]]
6238 !! result
6239 <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>
6240 </p>
6241 !! end
6242
6243 !! test
6244 RFC code coverage
6245 !! input
6246 RFC 983&#x20;987
6247 !! result
6248 <p><a href="http://tools.ietf.org/html/rfc983" class="external" title="http://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
6249 </p>
6250 !! end
6251
6252 !! test
6253 Centre-aligned image
6254 !! input
6255 [[Image:foobar.jpg|centre]]
6256 !! result
6257 <div class="center"><div class="floatnone"><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div></div>
6258
6259 !!end
6260
6261 !! test
6262 None-aligned image
6263 !! input
6264 [[Image:foobar.jpg|none]]
6265 !! result
6266 <div class="floatnone"><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" border="0" /></a></div>
6267
6268 !!end
6269
6270 !! test
6271 Width + Height sized image (using px) (height is ignored)
6272 !! input
6273 [[Image:foobar.jpg|640x480px]]
6274 !! result
6275 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6276 </p>
6277 !!end
6278
6279 !! test
6280 Width-sized image (using px, no following whitespace)
6281 !! input
6282 [[Image:foobar.jpg|640px]]
6283 !! result
6284 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6285 </p>
6286 !!end
6287
6288 !! test
6289 Width-sized image (using px, with following whitespace - test regression from r39467)
6290 !! input
6291 [[Image:foobar.jpg|640px ]]
6292 !! result
6293 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6294 </p>
6295 !!end
6296
6297 !! test
6298 Width-sized image (using px, with preceding whitespace - test regression from r39467)
6299 !! input
6300 [[Image:foobar.jpg| 640px]]
6301 !! result
6302 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Foobar.jpg"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" border="0" /></a>
6303 </p>
6304 !!end
6305
6306 !! test
6307 Another italics / bold test
6308 !! input
6309 ''' ''x'
6310 !! result
6311 <pre>'<i> </i>x'
6312 </pre>
6313 !!end
6314
6315 # Note the results may be incorrect, as parserTest output included this:
6316 # XML error: Mismatched tag at byte 6120:
6317 # ...<dd> </dt></dl> </dd...
6318 !! test
6319 dt/dd/dl test
6320 !! input
6321 :;;;::
6322 !! result
6323 <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd>
6324 </dd></dl>
6325 </dd></dl>
6326 </dt></dl>
6327 </dt></dl>
6328 </dt></dl>
6329 </dd></dl>
6330
6331 !!end
6332
6333
6334 # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
6335 !! test
6336 Images with the "|" character in the comment
6337 !! input
6338 [[image:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
6339 !! result
6340 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="image" title="An external URL"><img alt="An external URL" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" border="0" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>An <a href="http://test/?param1=|left|&amp;param2=|x" class="external text" title="http://test/?param1=|left|&amp;param2=|x" rel="nofollow">external</a> URL</div></div></div>
6341
6342 !!end
6343
6344 !! test
6345 [Before] HTML without raw HTML enabled ($wgRawHtml==false)
6346 !! input
6347 <html><script>alert(1);</script></html>
6348 !! result
6349 <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
6350 </p>
6351 !! end
6352
6353 !! test
6354 HTML with raw HTML ($wgRawHtml==true)
6355 !! options
6356 rawhtml
6357 !! input
6358 <html><script>alert(1);</script></html>
6359 !! result
6360 <p><script>alert(1);</script>
6361 </p>
6362 !! end
6363
6364 !! test
6365 Parents of subpages, one level up
6366 !! options
6367 subpage title=[[Subpage test/L1/L2/L3]]
6368 !! input
6369 [[../|L2]]
6370 !! result
6371 <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>
6372 </p>
6373 !! end
6374
6375
6376 !! test
6377 Parents of subpages, one level up, not named
6378 !! options
6379 subpage title=[[Subpage test/L1/L2/L3]]
6380 !! input
6381 [[../]]
6382 !! result
6383 <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>
6384 </p>
6385 !! end
6386
6387
6388
6389 !! test
6390 Parents of subpages, two levels up
6391 !! options
6392 disabled
6393 subpage title=[[Subpage test/L1/L2/L3]]
6394 !! input
6395 [[../../|L1]]2
6396 !! result
6397 <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>
6398 </p>
6399 !! end
6400
6401 !! test
6402 Parents of subpages, two levels up, without trailing slash or name.
6403 !! options
6404 subpage title=[[Subpage test/L1/L2/L3]]
6405 !! input
6406 [[../..]]
6407 !! result
6408 <p>[[../..]]
6409 </p>
6410 !! end
6411
6412 !! test
6413 Parents of subpages, two levels up, with lots of extra trailing slashes.
6414 !! options
6415 subpage title=[[Subpage test/L1/L2/L3]]
6416 !! input
6417 [[../../////]]
6418 !! result
6419 <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>
6420 </p>
6421 !! end
6422
6423 !! test
6424 Definition list code coverage
6425 !! input
6426 ; title : def
6427 ; title : def
6428 ;title: def
6429 !! result
6430 <dl><dt> title &nbsp;</dt><dd> def
6431 </dd><dt> title&nbsp;</dt><dd> def
6432 </dd><dt>title</dt><dd> def
6433 </dd></dl>
6434
6435 !! end
6436
6437 !! test
6438 Don't fall for the self-closing div
6439 !! input
6440 <div>hello world</div/>
6441 !! result
6442 <div>hello world</div>
6443
6444 !! end
6445
6446 !! test
6447 MSGNW magic word
6448 !! input
6449 {{MSGNW:msg}}
6450 !! result
6451 <p>&#91;&#91;:Template:Msg&#93;&#93;
6452 </p>
6453 !! end
6454
6455 !! test
6456 RAW magic word
6457 !! input
6458 {{RAW:QUERTY}}
6459 !! result
6460 <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>
6461 </p>
6462 !! end
6463
6464 # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
6465 !! test
6466 Always escape literal '>' in output, not just after '<'
6467 !! input
6468 ><>
6469 !! result
6470 <p>&gt;&lt;&gt;
6471 </p>
6472 !! end
6473
6474 !! test
6475 Template caching
6476 !! input
6477 {{Test}}
6478 {{Test}}
6479 !! result
6480 <p>This is a test template
6481 This is a test template
6482 </p>
6483 !! end
6484
6485
6486 !! article
6487 MediaWiki:Fake
6488 !! text
6489 ==header==
6490 !! endarticle
6491
6492 !! test
6493 Inclusion of !userCanEdit() content
6494 !! input
6495 {{MediaWiki:Fake}}
6496 !! result
6497 <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>
6498
6499 !! end
6500
6501
6502 !! test
6503 Out-of-order TOC heading levels
6504 !! input
6505 ==2==
6506 ======6======
6507 ===3===
6508 =1=
6509 =====5=====
6510 ==2==
6511 !! result
6512 <table id="toc" class="toc" summary="Contents"><tr><td><div id="toctitle"><h2>Contents</h2></div>
6513 <ul>
6514 <li class="toclevel-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
6515 <ul>
6516 <li class="toclevel-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
6517 <li class="toclevel-2"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
6518 </ul>
6519 </li>
6520 <li class="toclevel-1"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
6521 <ul>
6522 <li class="toclevel-2"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
6523 <li class="toclevel-2"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
6524 </ul>
6525 </li>
6526 </ul>
6527 </td></tr></table><script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide"; showTocToggle(); } </script>
6528 <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>
6529 <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>
6530 <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>
6531 <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>
6532 <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>
6533 <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>
6534
6535 !! end
6536
6537
6538 !! test
6539 ISBN with a dummy number
6540 !! input
6541 ISBN ---
6542 !! result
6543 <p>ISBN ---
6544 </p>
6545 !! end
6546
6547
6548 !! test
6549 ISBN with space-delimited number
6550 !! input
6551 ISBN 92 9017 032 8
6552 !! result
6553 <p><a href="/wiki/Special:BookSources/9290170328" class="internal">ISBN 92 9017 032 8</a>
6554 </p>
6555 !! end
6556
6557
6558 !! test
6559 ISBN with multiple spaces, no number
6560 !! input
6561 ISBN foo
6562 !! result
6563 <p>ISBN foo
6564 </p>
6565 !! end
6566
6567
6568 !! test
6569 ISBN length
6570 !! input
6571 ISBN 123456789
6572
6573 ISBN 1234567890
6574
6575 ISBN 12345678901
6576 !! result
6577 <p>ISBN 123456789
6578 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1234567890</a>
6579 </p><p>ISBN 12345678901
6580 </p>
6581 !! end
6582
6583
6584 !! test
6585 ISBN with trailing year (bug 8110)
6586 !! input
6587 ISBN 1-234-56789-0 - 2006
6588
6589 ISBN 1 234 56789 0 - 2006
6590 !! result
6591 <p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1-234-56789-0</a> - 2006
6592 </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal">ISBN 1 234 56789 0</a> - 2006
6593 </p>
6594 !! end
6595
6596
6597 !! test
6598 Pages in namespace (Magic word disabled currently)
6599 !! input
6600 {{PAGESINNAMESPACE:}}
6601 !! result
6602
6603 !! end
6604
6605
6606 !! test
6607 anchorencode
6608 !! input
6609 {{anchorencode:foo bar©#%n}}
6610 !! result
6611 <p>foo_bar.C2.A9.23.25n
6612 </p>
6613 !! end
6614
6615
6616 !! test
6617 Bug 8293: Use of center tag ruins paragraph formatting
6618 !! input
6619 <center>
6620 foo
6621 </center>
6622
6623 bar
6624
6625 baz
6626 !! result
6627 <center>
6628 <p>foo
6629 </p>
6630 </center>
6631 <p>bar
6632 </p>
6633 <pre>baz
6634 </pre>
6635 !! end
6636
6637
6638 ###
6639 ### Language variants related tests
6640 ###
6641 !! test
6642 Self-link in language variants
6643 !! options
6644 title=[[Dunav]] language=sr
6645 !! input
6646 Both [[Dunav]] and [[Дунав]] are names for this river.
6647 !! result
6648 <p>Both <strong class="selflink">Dunav</strong> and <strong class="selflink">Дунав</strong> are names for this river.
6649 </p>
6650 !!end
6651
6652
6653 !! test
6654 Link to pages in language variants
6655 !! options
6656 language=sr
6657 !! input
6658 Main Page can be written as [[Маин Паге]]
6659 !! result
6660 <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
6661 </p>
6662 !!end
6663
6664
6665 !! test
6666 Multiple links to pages in language variants
6667 !! options
6668 language=sr
6669 !! input
6670 [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
6671 !! result
6672 <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>.
6673 </p>
6674 !!end
6675
6676
6677 !! test
6678 Simple template in language variants
6679 !! options
6680 language=sr
6681 !! input
6682 {{тест}}
6683 !! result
6684 <p>This is a test template
6685 </p>
6686 !! end
6687
6688
6689 !! test
6690 Template with explicit namespace in language variants
6691 !! options
6692 language=sr
6693 !! input
6694 {{Template:тест}}
6695 !! result
6696 <p>This is a test template
6697 </p>
6698 !! end
6699
6700
6701 !! test
6702 Basic test for template parameter in language variants
6703 !! options
6704 language=sr
6705 !! input
6706 {{парамтест|param=foo}}
6707 !! result
6708 <p>This is a test template with parameter foo
6709 </p>
6710 !! end
6711
6712
6713 !! test
6714 Simple category in language variants
6715 !! options
6716 language=sr cat
6717 !! input
6718 [[:Category:МедиаWики Усер'с Гуиде]]
6719 !! result
6720 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#039;s Guide">MediaWiki User's Guide</a>
6721 !! end
6722
6723
6724 !! test
6725 Stripping -{}- tags (language variants)
6726 !! options
6727 language=sr
6728 !! input
6729 Latin proverb: -{Ne nuntium necare}-
6730 !! result
6731 <p>Latin proverb: Ne nuntium necare
6732 </p>
6733 !! end
6734
6735
6736 !! test
6737 Prevent conversion with -{}- tags (language variants)
6738 !! options
6739 language=sr variant=sr-ec
6740 !! input
6741 Latinski: -{Ne nuntium necare}-
6742 !! result
6743 <p>Латински: Ne nuntium necare
6744 </p>
6745 !! end
6746
6747
6748 !! test
6749 Prevent conversion of text with -{}- tags (language variants)
6750 !! options
6751 language=sr variant=sr-ec
6752 !! input
6753 Latinski: -{Ne nuntium necare}-
6754 !! result
6755 <p>Латински: Ne nuntium necare
6756 </p>
6757 !! end
6758
6759
6760 !! test
6761 Prevent conversion of links with -{}- tags (language variants)
6762 !! options
6763 language=sr variant=sr-ec
6764 !! input
6765 -{[[Main Page]]}-
6766 !! result
6767 <p><a href="/index.php?title=Main_Page&amp;variant=sr-ec" title="Main Page">Main Page</a>
6768 </p>
6769 !! end
6770
6771
6772 !! test
6773 -{}- tags within headlines (within html for parserConvert())
6774 !! options
6775 language=sr variant=sr-ec
6776 !! input
6777 == -{Naslov}- ==
6778 !! result
6779 <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>
6780
6781 !! end
6782
6783
6784 !! test
6785 Explicit definition of language variant alternatives
6786 !! options
6787 language=zh variant=zh-tw
6788 !! input
6789 -{zh:China;zh-tw:Taiwan}-, not China
6790 !! result
6791 <p>Taiwan, not China
6792 </p>
6793 !! end
6794
6795
6796 !! test
6797 Adding explicit session-wise language variant mapping (A flag)
6798 !! options
6799 language=zh variant=zh-tw
6800 !! input
6801 -{A|zh:China;zh-tw:Taiwan}- is China
6802 !! result
6803 <p>Taiwan is Taiwan
6804 </p>
6805 !! end
6806
6807
6808 !! test
6809 Adding explicit conversion rule for title (T flag)
6810 !! options
6811 language=zh variant=zh-tw
6812 !! input
6813 Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
6814 !! result
6815 <p>Should be stripped!
6816 </p>
6817 !! end
6818
6819
6820 !! test
6821 Raw output of variant escape tags (R flag)
6822 !! options
6823 language=zh variant=zh-tw
6824 !! input
6825 Raw: -{R|zh:China;zh-tw:Taiwan}-
6826 !! result
6827 <p>Raw: zh:China;zh-tw:Taiwan
6828 </p>
6829 !! end
6830
6831
6832 !! test
6833 Do not convert roman numbers to language variants
6834 !! options
6835 language=sr variant=sr-ec
6836 !! input
6837 Fridrih IV je car.
6838 !! result
6839 <p>Фридрих IV је цар.
6840 </p>
6841 !! end
6842
6843 !!article
6844 Template:Bullet
6845 !!text
6846 * Bar
6847 !!endarticle
6848
6849 !! test
6850 Bug 529: Uncovered bullet
6851 !! input
6852 * Foo {{bullet}}
6853 !! result
6854 <ul><li> Foo
6855 </li><li> Bar
6856 </li></ul>
6857
6858 !! end
6859
6860 !! test
6861 Bug 529: Uncovered table already at line-start
6862 !! input
6863 x
6864
6865 {{table}}
6866 y
6867 !! result
6868 <p>x
6869 </p>
6870 <table>
6871 <tr>
6872 <td> 1 </td><td> 2
6873 </td></tr>
6874 <tr>
6875 <td> 3 </td><td> 4
6876 </td></tr></table>
6877 <p>y
6878 </p>
6879 !! end
6880
6881 !! test
6882 Bug 529: Uncovered bullet in parser function result
6883 !! input
6884 * Foo {{lc:{{bullet}} }}
6885 !! result
6886 <ul><li> Foo
6887 </li><li> bar
6888 </li></ul>
6889
6890 !! end
6891
6892 !! test
6893 Bug 5678: Double-parsed template argument
6894 !! input
6895 {{lc:{{{1}}}|hello}}
6896 !! result
6897 <p>{{{1}}}
6898 </p>
6899 !! end
6900
6901 !! test
6902 Bug 5678: Double-parsed template invocation
6903 !! input
6904 {{lc:{{paramtest {{!}} param = hello }} }}
6905 !! result
6906 <p>{{paramtest | param = hello }}
6907 </p>
6908 !! end
6909
6910 !! test
6911 Morwen/13: Unclosed link followed by heading
6912 !! input
6913 [[link
6914 ==heading==
6915 !! result
6916 <p>[[link
6917 </p>
6918 <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>
6919
6920 !! end
6921
6922 !! test
6923 HHP2.1: Heuristics for headings in preprocessor parenthetical structures
6924 !! input
6925 {{foo|
6926 =heading=
6927 !! result
6928 <p>{{foo|
6929 </p>
6930 <a name="heading"></a><h1> <span class="mw-headline">heading</span></h1>
6931
6932 !! end
6933
6934 !! test
6935 HHP2.2: Heuristics for headings in preprocessor parenthetical structures
6936 !! input
6937 {{foo|
6938 ==heading==
6939 !! result
6940 <p>{{foo|
6941 </p>
6942 <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>
6943
6944 !! end
6945
6946 !! test
6947 Tildes in comments
6948 !! options
6949 pst
6950 !! input
6951 <!-- ~~~~ -->
6952 !! result
6953 <!-- ~~~~ -->
6954 !! end
6955
6956 !! test
6957 Paragraphs inside divs (no extra line breaks)
6958 !! input
6959 <div>Line one
6960
6961 Line two</div>
6962 !! result
6963 <div>Line one
6964 Line two</div>
6965
6966 !! end
6967
6968 !! test
6969 Paragraphs inside divs (extra line break on open)
6970 !! input
6971 <div>
6972 Line one
6973
6974 Line two</div>
6975 !! result
6976 <div>
6977 <p>Line one
6978 </p>
6979 Line two</div>
6980
6981 !! end
6982
6983 !! test
6984 Paragraphs inside divs (extra line break on close)
6985 !! input
6986 <div>Line one
6987
6988 Line two
6989 </div>
6990 !! result
6991 <div>Line one
6992 <p>Line two
6993 </p>
6994 </div>
6995
6996 !! end
6997
6998 !! test
6999 Paragraphs inside divs (extra line break on open and close)
7000 !! input
7001 <div>
7002 Line one
7003
7004 Line two
7005 </div>
7006 !! result
7007 <div>
7008 <p>Line one
7009 </p><p>Line two
7010 </p>
7011 </div>
7012
7013 !! end
7014
7015 # Bug 6200: <blockquote> should behave like <div> with respect to line breaks
7016 !! test
7017 Bug 6200: paragraphs inside blockquotes (no extra line breaks)
7018 !! input
7019 <blockquote>Line one
7020
7021 Line two</blockquote>
7022 !! result
7023 <blockquote>Line one
7024 Line two</blockquote>
7025
7026 !! end
7027
7028 !! test
7029 Bug 6200: paragraphs inside blockquotes (extra line break on open)
7030 !! input
7031 <blockquote>
7032 Line one
7033
7034 Line two</blockquote>
7035 !! result
7036 <blockquote>
7037 <p>Line one
7038 </p>
7039 Line two</blockquote>
7040
7041 !! end
7042
7043 !! test
7044 Bug 6200: paragraphs inside blockquotes (extra line break on close)
7045 !! input
7046 <blockquote>Line one
7047
7048 Line two
7049 </blockquote>
7050 !! result
7051 <blockquote>Line one
7052 <p>Line two
7053 </p>
7054 </blockquote>
7055
7056 !! end
7057
7058 !! test
7059 Bug 6200: paragraphs inside blockquotes (extra line break on open and close)
7060 !! input
7061 <blockquote>
7062 Line one
7063
7064 Line two
7065 </blockquote>
7066 !! result
7067 <blockquote>
7068 <p>Line one
7069 </p><p>Line two
7070 </p>
7071 </blockquote>
7072
7073 !! end
7074
7075 !! test
7076 Paragraphs inside blockquotes/divs (no extra line breaks)
7077 !! input
7078 <blockquote><div>Line one
7079
7080 Line two</div></blockquote>
7081 !! result
7082 <blockquote><div>Line one
7083 Line two</div></blockquote>
7084
7085 !! end
7086
7087 !! test
7088 Paragraphs inside blockquotes/divs (extra line break on open)
7089 !! input
7090 <blockquote><div>
7091 Line one
7092
7093 Line two</div></blockquote>
7094 !! result
7095 <blockquote><div>
7096 <p>Line one
7097 </p>
7098 Line two</div></blockquote>
7099
7100 !! end
7101
7102 !! test
7103 Paragraphs inside blockquotes/divs (extra line break on close)
7104 !! input
7105 <blockquote><div>Line one
7106
7107 Line two
7108 </div></blockquote>
7109 !! result
7110 <blockquote><div>Line one
7111 <p>Line two
7112 </p>
7113 </div></blockquote>
7114
7115 !! end
7116
7117 !! test
7118 Paragraphs inside blockquotes/divs (extra line break on open and close)
7119 !! input
7120 <blockquote><div>
7121 Line one
7122
7123 Line two
7124 </div></blockquote>
7125 !! result
7126 <blockquote><div>
7127 <p>Line one
7128 </p><p>Line two
7129 </p>
7130 </div></blockquote>
7131
7132 !! end
7133
7134 !! test
7135 Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
7136 !! options
7137 wgLinkHolderBatchSize=0
7138 !! input
7139 [[meatball:1]]
7140 [[meatball:2]]
7141 [[meatball:3]]
7142 !! result
7143 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
7144 <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
7145 <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
7146 </p>
7147 !! end
7148
7149 !! test
7150 Free external link invading image caption
7151 !! input
7152 [[Image:Foobar.jpg|thumb|http://x|hello]]
7153 !! result
7154 <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/Image: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/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" /></a></div>hello</div></div></div>
7155
7156 !! end
7157
7158 !! test
7159 Bug 15196: localised external link numbers
7160 !! options
7161 language=fa
7162 !! input
7163 [http://en.wikipedia.org/]
7164 !! result
7165 <p><a href="http://en.wikipedia.org/" class="external autonumber" title="http://en.wikipedia.org/" rel="nofollow">[۱]</a>
7166 </p>
7167 !! end
7168
7169 !!test
7170 <poem>
7171 !!input
7172 <poem>
7173 this
7174 is
7175 a
7176 test
7177 </poem>
7178 !!result
7179 <div class="poem">
7180 <p>this<br />
7181 is<br />
7182 a<br />
7183 test
7184 </p>
7185 </div>
7186
7187 !!end
7188
7189 !!test
7190 <poem> with recursive parsing
7191 !!input
7192 <poem>
7193 this ''is'' a '''test'''
7194 </poem>
7195 !! result
7196 <div class="poem">
7197 <p>this <i>is</i> a <b>test</b>
7198 </p>
7199 </div>
7200
7201 !!end
7202
7203
7204 !!test
7205 <poem> with leading whitespace
7206 !!input
7207 <poem>
7208
7209 test
7210
7211 </poem>
7212 !!result
7213 <div class="poem">
7214 <p><br />
7215 &nbsp;&nbsp;&nbsp;test<br />
7216 </p>
7217 </div>
7218
7219 !!end
7220
7221 !!test
7222 Horizontal rule
7223 !!input
7224 <poem>
7225 some
7226 -----
7227 text
7228 </poem>
7229 !!result
7230 <div class="poem">
7231 <p>some<br />
7232 </p>
7233 <hr /><br />
7234 <p>text
7235 </p>
7236 </div>
7237
7238 !!end
7239
7240 !!test
7241 nested <poem><nowiki>
7242 !!input
7243 <poem><nowiki>
7244 this
7245 is
7246 a
7247 test
7248 </nowiki></poem>
7249 !!result
7250 <div class="poem">
7251 <p>this<br />
7252 is<br />
7253 a<br />
7254 test
7255 </p>
7256 </div>
7257
7258 !!end
7259
7260 !!test
7261 nested <poem><nowiki> with formatting
7262 !!input
7263 <poem><nowiki>
7264 this
7265 '''is'''
7266 a
7267 test
7268 </nowiki></poem>
7269 !!result
7270 <div class="poem">
7271 <p>this<br />
7272 '''is'''<br />
7273 a<br />
7274 test
7275 </p>
7276 </div>
7277
7278 !! end
7279
7280 #
7281 #
7282 #
7283
7284 TODO:
7285 more images
7286 more tables
7287 math
7288 character entities
7289 and much more
7290 Try for 100% code coverage