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