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