* Deglobalised link placeholder handling by moving the relevant functionality from...
[mediawiki.git] / maintenance / parserTests.txt
blobc0c9787e61a2de80051f8ead90e157f62458b910
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
5 # The syntax should be fairly self-explanatory.
7 # Currently supported test options:
8 #       One of the following three:
10 #       (default)       generate HTML output
11 #       pst             apply pre-save transform
12 #       msg             apply message transform
14 #       Plus any combination of these:
16 #       cat             add category links
17 #       ill             add inter-language links
18 #       subpage         enable subpages (disabled by default)
19 #       title=[[XXX]]   run test using article title XXX
20 #       disabled        do not run test
22 # For testing purposes, temporary articles can created:
23 # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
24 # where '/' denotes a newline.
26 # This is the standard article assumed to exist.
27 !! article
28 Main Page
29 !! text
30 blah blah
31 !! endarticle
33 ###
34 ### Basic tests
35 ###
36 !! test
37 Blank input
38 !! input
39 !! result
40 !! end
43 !! test
44 Simple paragraph
45 !! input
46 This is a simple paragraph.
47 !! result
48 <p>This is a simple paragraph.
49 </p>
50 !! end
52 !! test
53 Simple list
54 !! input
55 * Item 1
56 * Item 2
57 !! result
58 <ul><li> Item 1
59 </li><li> Item 2
60 </li></ul>
62 !! end
64 !! test
65 Italics and bold
66 !! input
67 * plain
68 * plain''italic''plain
69 * plain''italic''plain''italic''plain
70 * plain'''bold'''plain
71 * plain'''bold'''plain'''bold'''plain
72 * plain''italic''plain'''bold'''plain
73 * plain'''bold'''plain''italic''plain
74 * plain''italic'''bold-italic'''italic''plain
75 * plain'''bold''bold-italic''bold'''plain
76 * plain'''''bold-italic'''italic''plain
77 * plain'''''bold-italic''bold'''plain
78 * plain''italic'''bold-italic'''''plain
79 * plain'''bold''bold-italic'''''plain
80 * plain l'''italic''plain
81 !! result
82 <ul><li> plain
83 </li><li> plain<i>italic</i>plain
84 </li><li> plain<i>italic</i>plain<i>italic</i>plain
85 </li><li> plain<b>bold</b>plain
86 </li><li> plain<b>bold</b>plain<b>bold</b>plain
87 </li><li> plain<i>italic</i>plain<b>bold</b>plain
88 </li><li> plain<b>bold</b>plain<i>italic</i>plain
89 </li><li> plain<i>italic<b>bold-italic</b>italic</i>plain
90 </li><li> plain<b>bold<i>bold-italic</i>bold</b>plain
91 </li><li> plain<i><b>bold-italic</b>italic</i>plain
92 </li><li> plain<b><i>bold-italic</i>bold</b>plain
93 </li><li> plain<i>italic<b>bold-italic</b></i>plain
94 </li><li> plain<b>bold<i>bold-italic</i></b>plain
95 </li><li> plain l'<i>italic</i>plain
96 </li></ul>
98 !! end
101 ### <nowiki> test cases
104 !! test
105 <nowiki> unordered list
106 !! input
107 <nowiki>* This is not an unordered list item.</nowiki>
108 !! result
109 <p>* This is not an unordered list item.
110 </p>
111 !! end
113 !! test
114 <nowiki> spacing
115 !! input
116 <nowiki>Lorem ipsum dolor
118 sed abit.
119   sed nullum.
121 :and a colon
122 </nowiki>
123 !! result
124 <p>Lorem ipsum dolor
126 sed abit.
127   sed nullum.
129 :and a colon
131 </p>
132 !! end
134 !! test
135 nowiki 3
136 !! input
137 :There is not nowiki.
138 :There is <nowiki>nowiki</nowiki>.
140 #There is not nowiki.
141 #There is <nowiki>nowiki</nowiki>.
143 *There is not nowiki.
144 *There is <nowiki>nowiki</nowiki>.
145 !! result
146 <dl><dd>There is not nowiki.
147 </dd><dd>There is nowiki.
148 </dd></dl>
149 <ol><li>There is not nowiki.
150 </li><li>There is nowiki.
151 </li></ol>
152 <ul><li>There is not nowiki.
153 </li><li>There is nowiki.
154 </li></ul>
156 !! end
159 ### comment test cases
161 !! test
162 Comment test 1
163 !! input
164 <!-- comment 1 --> asdf
165 <!-- comment 2 -->
166 !! result
167 <pre>asdf
168 </pre>
170 !! end
172 !! test
173 Comment test 2
174 !! input
175 asdf
176 <!-- comment 1 -->
178 !! result
179 <p>asdf
181 </p>
182 !! end
184 !! test
185 Comment test 3
186 !! input
187 asdf
188 <!-- comment 1 -->
189 <!-- comment 2 -->
191 !! result
192 <p>asdf
194 </p>
195 !! end
197 !! test
198 Comment test 4
199 !! input
200 asdf<!-- comment 1 -->jkl
201 !! result
202 <p>asdfjkl
203 </p>
204 !! end
206 !! test
207 Comment spacing
208 !! input
210  <!-- foo --> b <!-- bar -->
212 !! result
213 <p>a
214 </p>
215 <pre> b 
216 </pre>
217 <p>c
218 </p>
219 !! end
222 ### Preformatted text
224 !! test
225 Preformatted text
226 !! input
227  This is some
228  Preformatted text
229  With ''italic''
230  And '''bold'''
231  And a [[Main Page|link]]
232 !! result
233 <pre>This is some
234 Preformatted text
235 With <i>italic</i>
236 And <b>bold</b>
237 And a <a href="/wiki/Main_Page" title="Main Page">link</a>
238 </pre>
239 !! end
242 ### Definition list
244 !! test
245 Simple definition
246 !! input
247 ; name : Definition
248 !! result
249 <dl><dt> name&nbsp;</dt><dd> Definition
250 </dd></dl>
252 !! end
254 !! test
255 Simple definition
256 !! input
257 : Indented text
258 !! result
259 <dl><dd> Indented text
260 </dd></dl>
262 !! end
264 !! test
265 Definition list with no space
266 !! input
267 ;name:Definition
268 !! result
269 <dl><dt>name</dt><dd>Definition
270 </dd></dl>
272 !!end
274 !! test
275 Definition list with URL link
276 !! input
277 ; http://example.com/ : definition
278 !! result
279 <dl><dt> <a href="http://example.com/" class='external free' title="http://example.com/" rel="nofollow">http://example.com/</a>&nbsp;</dt><dd> definition
280 </dd></dl>
282 !! end
284 !! test
285 Definition list with bracketed URL link
286 !! input
287 ;[http://www.google.com/ Google]:Number one search engine
288 !! result
289 <dl><dt><a href="http://www.google.com/" class='external text' title="http://www.google.com/" rel="nofollow">Google</a></dt><dd>Number one search engine
290 </dd></dl>
292 !! end
294 !! test
295 Definition list with wikilink containing colon
296 !! input
297 ; [[Wikipedia:FAQ]]: The least-read page on Wikipedia
298 !! result
299 <dl><dt> <a href="/index.php?title=Wikipedia:FAQ&amp;action=edit" class="new" title="Wikipedia:FAQ">Wikipedia:FAQ</a></dt><dd> The least-read page on Wikipedia
300 </dd></dl>
302 !! end
304 # At Brion's and JeLuF's insistence... :)
305 !! test
306 Definition list with wikilink containing colon
307 !! input
308 ;  news:alt.wikipedia.rox: This isn't even a real newsgroup!
309 !! result
310 <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!
311 </dd></dl>
313 !! end
315 !! test
316 Malformed definition list with colon
317 !! input
318 ;  news:alt.wikipedia.rox -- don't crash or enter an infinite loop
319 !! result
320 <dl><dt>  <a href="news:alt.wikipedia.rox" class='external free' title="news:alt.wikipedia.rox" rel="nofollow">news:alt.wikipedia.rox</a>&nbsp;&mdash; don't crash or enter an infinite loop
321 </dt></dl>
323 !! end
325 !! test
326 Definition lists: colon in external link text
327 !! input
328 ; [http://www.wikipedia2.org/ Wikipedia : The Next Generation]: OK, I made that up
329 !! result
330 <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
331 </dd></dl>
333 !! end
337 ### External links
339 !! test
340 External links: non-bracketed
341 !! input
342 Non-bracketed: http://example.com
343 !! result
344 <p>Non-bracketed: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
345 </p>
346 !! end
348 !! test
349 External links: numbered
350 !! input
351 Numbered: [http://example.com]
352 !! result
353 <p>Numbered: <a href="http://example.com" class='external autonumber' title="http://example.com" rel="nofollow">[1]</a>
354 </p>
355 !!end
357 !! test
358 External links: specified text
359 !! input
360 Specified text: [http://example.com link]
361 !! result
362 <p>Specified text: <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>
363 </p>
364 !!end
366 !! test
367 External links: trail
368 !! input
369 Trail (not sure if this is meant to work): [http://example.com link]s
370 !! result
371 <p>Trail (not sure if this is meant to work): <a href="http://example.com" class='external text' title="http://example.com" rel="nofollow">link</a>s
372 </p>
373 !! end
375 !! test
376 External links: dollar sign in URL
377 !! input
378 http://example.com/1$2345
379 !! result
380 <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>
381 </p>
382 !! end
384 !! test
385 External links: dollar sign in URL (named)
386 !! input
387 [http://example.com/1$2345]
388 !! result
389 <p><a href="http://example.com/1$2345" class='external autonumber' title="http://example.com/1$2345" rel="nofollow">[1]</a>
390 </p>
391 !!end
393 !! test
394 External image
395 !! input
396 External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
397 !! result
398 <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
399 </p>
400 !! end
402 !! test
403 External image from https
404 !! input
405 External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
406 !! result
407 <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
408 </p>
409 !! end
411 !! test
412 Link to non-http image, no img tag
413 !! input
414 Link to non-http image, no img tag: ftp://example.com/test.jpg
415 !! result
416 <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>
417 </p>
418 !! end
420 !! test
421 External links: terminating separator
422 !! input
423 Terminating separator: http://example.com/thing,
424 !! result
425 <p>Terminating separator: <a href="http://example.com/thing" class='external free' title="http://example.com/thing" rel="nofollow">http://example.com/thing</a>,
426 </p>
427 !! end
429 !! test
430 External links: intervening separator
431 !! input
432 Intervening separator: http://example.com/1,2,3
433 !! result
434 <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>
435 </p>
436 !! end
438 !! test
439 External links: old bug with URL in query
440 !! input
441 Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
442 !! result
443 <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>
444 </p>
445 !! end
447 !! test
448 External links: old URL-in-URL bug, mixed protocols
449 !! input
450 And again with mixed protocols: [ftp://example.com?url=http://example.com link]
451 !! result
452 <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>
453 </p>
454 !!end
456 !! test
457 External links: URL in text
458 !! input
459 URL in text: [http://example.com http://example.com]
460 !! result
461 <p>URL in text: <a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>
462 </p>
463 !! end
465 !! test
466 External links: Clickable images
467 !! input
468 ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
469 !! result
470 <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>
471 </p>
472 !!end
474 !! test
475 External links: raw ampersand
476 !! input
477 Old &amp; use: http://x&y
478 !! result
479 <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>
480 </p>
481 !! end
483 !! test
484 External links: encoded ampersand
485 !! input
486 Old &amp; use: http://x&amp;y
487 !! result
488 <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>
489 </p>
490 !! end
492 !! test
493 External links: [raw ampersand]
494 !! input
495 Old &amp; use: [http://x&y]
496 !! result
497 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
498 </p>
499 !! end
501 !! test
502 External links: [encoded ampersand]
503 !! input
504 Old &amp; use: [http://x&amp;y]
505 !! result
506 <p>Old &amp; use: <a href="http://x&amp;y" class='external autonumber' title="http://x&amp;y" rel="nofollow">[1]</a>
507 </p>
508 !! end
510 !! test
511 External links: www.jpeg.org (bug 554)
512 !! input
513 http://www.jpeg.org
514 !!result
515 <p><a href="http://www.jpeg.org" class='external free' title="http://www.jpeg.org" rel="nofollow">http://www.jpeg.org</a>
516 </p>
517 !! end
519 !! test
520 External links: URL within URL (original bug 2)
521 !! input
522 [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
523 !! result
524 <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>
525 </p>
526 !! end
528 !! test
529 BUG 361: URL inside bracketed URL
530 !! input
531 [http://www.example.com/foo http://www.example.com/bar]
532 !! result
533 <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>
534 </p>
535 !! end
537 !! test
538 BUG 361: URL within URL, not bracketed
539 !! input
540 http://www.example.com/foo?=http://www.example.com/bar
541 !! result
542 <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>
543 </p>
544 !! end
546 !! test
547 BUG 289: ">"-token in URL-tail
548 !! input
549 http://www.example.com/<hello>
550 !! result
551 <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;
552 </p>
553 !!end
555 !! test
556 BUG 289: literal ">"-token in URL-tail
557 !! input
558 http://www.example.com/<b>html</b>
559 !! result
560 <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>
561 </p>
562 !!end
564 !! test
565 BUG 289: ">"-token in bracketed URL
566 !! input
567 [http://www.example.com/<hello> stuff]
568 !! result
569 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
570 </p>
571 !!end
573 !! test
574 BUG 289: literal ">"-token in bracketed URL
575 !! input
576 [http://www.example.com/<b>html</b> stuff]
577 !! result
578 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
579 </p>
580 !!end
582 !! test
583 BUG 289: literal double quote at end of URL
584 !! input
585 http://www.example.com/"hello"
586 !! result
587 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
588 </p>
589 !!end
591 !! test
592 BUG 289: literal double quote in bracketed URL
593 !! input
594 [http://www.example.com/"hello" stuff]
595 !! result
596 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
597 </p>
598 !!end
600 !! test
601 External links: invalid character
602 !! input
603 [http://www.example.com\0 test]
604 !! result
605 <p>[<a href="http://www.example.com" class='external free' title="http://www.example.com" rel="nofollow">http://www.example.com</a>\0 test]
606 </p>
607 !! end
610 ### Quotes
613 !! test
614 Quotes
615 !! input
616 Normal text. '''Bold text.''' Normal text. ''Italic text.''
618 Normal text. '''''Bold italic text.''''' Normal text.
619 !!result
620 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
621 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
622 </p>
623 !! end
626 !! test
627 Unclosed and unmatched quotes
628 !! input
629 '''''Bold italic text '''with bold deactivated''' in between.'''''
631 '''''Bold italic text ''with italic deactivated'' in between.'''''
633 '''Bold text..
635 ..spanning two paragraphs (should not work).'''
637 '''Bold tag left open
639 ''Italic tag left open
641 Normal text.
643 <!-- Unmatching number of opening, closing tags: -->
644 '''This year''''s election ''should'' beat '''last year''''s.
646 ''Tom'''s car is bigger than ''Susan'''s.
647 !! result
648 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
649 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
650 </p><p><b>Bold text..</b>
651 </p><p>..spanning two paragraphs (should not work).<b></b>
652 </p><p><b>Bold tag left open</b>
653 </p><p><i>Italic tag left open</i>
654 </p><p>Normal text.
655 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
656 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
657 </p>
658 !! end
661 ### Tables
663 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
665 !! test
666 Simple table
667 !! input
668 {| 
669 | 1 || 2
670 |- 
671 | 3 || 4
673 !! result
674 <table>
675 <tr>
676 <td> 1 </td><td> 2
677 </td></tr>
678 <tr>
679 <td> 3 </td><td> 4
680 </td></tr></table>
682 !! end
684 !! test
685 Multiplication table
686 !! input
687 {| border="1" cellpadding="2"
688 |+Multiplication table
690 ! &times; !! 1 !! 2 !! 3
692 ! 1
693 | 1 || 2 || 3
695 ! 2
696 | 2 || 4 || 6
698 ! 3
699 | 3 || 6 || 9
701 ! 4
702 | 4 || 8 || 12
704 ! 5
705 | 5 || 10 || 15
707 !! result
708 <table border="1" cellpadding="2">
709 <caption>Multiplication table
710 </caption>
711 <tr>
712 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
713 </th></tr>
714 <tr>
715 <th> 1
716 </th><td> 1 </td><td> 2 </td><td> 3
717 </td></tr>
718 <tr>
719 <th> 2
720 </th><td> 2 </td><td> 4 </td><td> 6
721 </td></tr>
722 <tr>
723 <th> 3
724 </th><td> 3 </td><td> 6 </td><td> 9
725 </td></tr>
726 <tr>
727 <th> 4
728 </th><td> 4 </td><td> 8 </td><td> 12
729 </td></tr>
730 <tr>
731 <th> 5
732 </th><td> 5 </td><td> 10 </td><td> 15
733 </td></tr></table>
735 !! end
737 !! test
738 Table rowspan
739 !! input
740 {| align=right border=1
741 | Cell 1, row 1 
742 |rowspan=2| Cell 2, row 1 (and 2) 
743 | Cell 3, row 1 
744 |- 
745 | Cell 1, row 2 
746 | Cell 3, row 2 
748 !! result
749 <table align="right" border="1">
750 <tr>
751 <td> Cell 1, row 1
752 </td><td rowspan="2"> Cell 2, row 1 (and 2)
753 </td><td> Cell 3, row 1
754 </td></tr>
755 <tr>
756 <td> Cell 1, row 2
757 </td><td> Cell 3, row 2
758 </td></tr></table>
760 !! end
762 !! test
763 Nested table
764 !! input
765 {| border=1
766 | &alpha;
768 {| bgcolor=#ABCDEF border=2
769 |nested
771 |table
773 |the original table again
775 !! result
776 <table border="1">
777 <tr>
778 <td> &alpha;
779 </td><td>
780 <table bgcolor="#ABCDEF" border="2">
781 <tr>
782 <td>nested
783 </td></tr>
784 <tr>
785 <td>table
786 </td></tr></table>
787 </td><td>the original table again
788 </td></tr></table>
790 !! end
792 !! test
793 Invalid attributes in table cell (bug 1830)
794 !! input
796 |Cell:|broken
798 !! result
799 <table>
800 <tr>
801 <td>broken
802 </td></tr></table>
804 !! end
809 ### Internal links
811 !! test
812 Plain link, capitalized
813 !! input
814 [[Main Page]]
815 !! result
816 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
817 </p>
818 !! end
820 !! test
821 Plain link, uncapitalized
822 !! input
823 [[main Page]]
824 !! result
825 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
826 </p>
827 !! end
829 !! test
830 Piped link
831 !! input
832 [[Main Page|The Main Page]]
833 !! result
834 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
835 </p>
836 !! end
838 !! test
839 Broken link
840 !! input
841 [[Zigzagzogzagzig]]
842 !! result
843 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
844 </p>
845 !! end
847 !! test
848 Link with prefix
849 !! input
850 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
851 !! result
852 <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>
853 </p>
854 !! end
856 !! test
857 Link with suffix
858 !! input
859 [[Main Page]]xxx, [[Main Page]]XXX
860 !! result
861 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
862 </p>
863 !! end
865 !! test
866 Link with 3 brackets
867 !! input
868 [[[main page]]]
869 !! result
870 <p>[[[main page]]]
871 </p>
872 !! end
874 !! test
875 Piped link with 3 brackets
876 !! input
877 [[[main page|the main page]]]
878 !! result
879 <p>[[[main page|the main page]]]
880 </p>
881 !! end
883 !! test
884 Link to namespaces
885 !! input
886 [[Talk:Parser testing]], [[Meta:Disclaimers]]
887 !! result
888 <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
889 </p>
890 !! end
892 !! test
893 Piped link to namespace
894 !! input
895 [[Meta:Disclaimers|The disclaimers]]
896 !! result
897 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
898 </p>
899 !! end
901 !! test
902 Link containing }
903 !! input
904 [[Usually caused by a typo (oops}]]
905 !! result
906 <p>[[Usually caused by a typo (oops}]]
907 </p>
908 !! end
910 !! test
911 Link containing % (not as a hex sequence)
912 !! input
913 [[7% Solution]]
914 !! result
915 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
916 </p>
917 !! end
919 !! test
920 Link containing % as a single hex sequence interpreted to char
921 !! input
922 [[7%25 Solution]]
923 !! result
924 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
925 </p>
926 !!end
928 !! test
929 Link containing % as a double hex sequence interpreted to hex sequence
930 !! input
931 [[7%2525 Solution]]
932 !! result
933 <p>[[7%2525 Solution]]
934 </p>
935 !!end
937 !! test
938 Plain link to URL
939 !! input
940 [[http://www.example.org]]
941 !! result
942 <p>[<a href="http://www.example.org" class='external autonumber' title="http://www.example.org" rel="nofollow">[1]</a>]
943 </p>
944 !! end
946 # I'm fairly sure the expected result here is wrong.
947 # We want these to be URL links, not pseudo-pages with URLs for titles....
948 # However the current output is also pretty screwy.
950 # ----
951 # I'm changing it to match the current output--it arguably makes more
952 # sense in the light of the test above. Old expected result was:
953 #<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>
954 #</p>
955 # But I think this test is bordering on "garbage in, garbage out" anyway.
956 # -- wtm
957 !! test
958 Piped link to URL
959 !! input
960 Piped link to URL: [[http://www.example.org|an example URL]]
961 !! result
962 <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>]
963 </p>
964 !! end
966 !! test
967 BUG 2: [[page|http://url/]] should link to page, not http://url/
968 !! input
969 [[Main Page|http://url/]]
970 !! result
971 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
972 </p>
973 !! end
975 !! test
976 BUG 337: Escaped self-links should be bold
977 !! options
978 title=[[Bug462]]
979 !! input
980 [[Bu&#103;462]] [[Bug462]]
981 !! result
982 <p><strong>Bu&#103;462</strong> <strong>Bug462</strong>
983 </p>
984 !! end
986 !! test
987 Self-link to section should not be bold
988 !! options
989 title=[[Main Page]]
990 !! input
991 [[Main Page#section]]
992 !! result
993 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
994 </p>
995 !! end
997 !! test
998 <nowiki> inside a link
999 !! input
1000 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
1001 !! result
1002 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
1003 </p>
1004 !! end
1007 ### Interwiki links (see maintenance/interwiki.sql)
1010 !! test
1011 Inline interwiki link
1012 !! input
1013 [[MeatBall:SoftSecurity]]
1014 !! result
1015 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw' title="MeatBall:SoftSecurity">MeatBall:SoftSecurity</a>
1016 </p>
1017 !! end
1019 !! test
1020 Interwiki link encoding conversion (bug 1636)
1021 !! input
1022 *[[Wikipedia:ro:Olteni&#0355;a]]
1023 *[[Wikipedia:ro:Olteni&#355;a]]
1024 !! result
1025 <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>
1026 </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>
1027 </li></ul>
1029 !! end
1032 ## XHTML tidiness
1035 !! test
1036 <br> to <br />
1037 !! input
1038 1<br>2<br />3
1039 !! result
1040 <p>1<br />2<br />3
1041 </p>
1042 !! end
1045 ### Block-level elements
1047 !! test
1048 Common list
1049 !! input
1050 *Common list
1051 * item 2
1052 *item 3
1053 !! result
1054 <ul><li>Common list
1055 </li><li> item 2
1056 </li><li>item 3
1057 </li></ul>
1059 !! end
1061 !! test
1062 Numbered list
1063 !! input
1064 #Numbered list
1065 #item 2
1066 # item 3
1067 !! result
1068 <ol><li>Numbered list
1069 </li><li>item 2
1070 </li><li> item 3
1071 </li></ol>
1073 !! end
1075 !! test
1076 Mixed list
1077 !! input
1078 *Mixed list
1079 *# with numbers
1080 ** and bullets
1081 *# and numbers
1082 *bullets again
1083 **bullet level 2
1084 ***bullet level 3
1085 ***#Number on level 4
1086 **bullet level 2
1087 **#Number on level 3
1088 **#Number on level 3
1089 *#number level 2
1090 *Level 1
1091 !! result
1092 <ul><li>Mixed list
1093 <ol><li> with numbers
1094 </li></ol>
1095 <ul><li> and bullets
1096 </li></ul>
1097 <ol><li> and numbers
1098 </li></ol>
1099 </li><li>bullets again
1100 <ul><li>bullet level 2
1101 <ul><li>bullet level 3
1102 <ol><li>Number on level 4
1103 </li></ol>
1104 </li></ul>
1105 </li><li>bullet level 2
1106 <ol><li>Number on level 3
1107 </li><li>Number on level 3
1108 </li></ol>
1109 </li></ul>
1110 <ol><li>number level 2
1111 </li></ol>
1112 </li><li>Level 1
1113 </li></ul>
1115 !! end
1118 ### Magic variables
1120 !! test
1121 Magic variables
1122 !! input
1123 {{SITENAME}}
1124 !! result
1125 <p>MediaWiki
1126 </p>
1127 !! end
1130 ### Magic links
1132 !! test
1133 Magic links: internal link to RFC
1134 !! input
1135 [[RFC 123]]
1136 !! result
1137 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1138 </p>
1139 !! end
1141 !! test
1142 Magic links: RFC
1143 !! input
1144 RFC 822
1145 !! result
1146 <p><a href='http://www.faqs.org/rfcs/rfc822.html' class='external' title="http://www.faqs.org/rfcs/rfc822.html">RFC 822</a>
1147 </p>
1148 !! end
1150 !! test
1151 Magic links: ISBN (bug 1937 unresolved)
1152 !! input
1153 ISBN 0-306-40615-2
1154 !! result
1155 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1156 </p>
1157 !! end
1159 !! test
1160 Magic links: PMID incorrectly converts space to underscore
1161 !! input
1162 PMID 1234
1163 !! result
1164 <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>
1165 </p>
1166 !! end
1169 ### Templates
1170 ####
1172 !! test
1173 Nonexistant template
1174 !! input
1175 {{thistemplatedoesnotexist}}
1176 !! result
1177 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1178 </p>
1179 !! end
1181 !! article
1182 Template:test
1183 !! text
1184 This is a test template
1185 !! endarticle
1187 !! test
1188 Simple template
1189 !! input
1190 {{test}}
1191 !! result
1192 <p>This is a test template
1193 </p>
1194 !! end
1196 !! test
1197 Template with explicit namespace
1198 !! input
1199 {{Template:test}}
1200 !! result
1201 <p>This is a test template
1202 </p>
1203 !! end
1206 !! article
1207 Template:paramtest
1208 !! text
1209 This is a test template with parameter {{{param}}}
1210 !! endarticle
1212 !! test
1213 Template parameter
1214 !! input
1215 {{paramtest|param=foo}}
1216 !! result
1217 <p>This is a test template with parameter foo
1218 </p>
1219 !! end
1221 !! article
1222 Template:paramtestnum
1223 !! text
1224 [[{{{1}}}|{{{2}}}]]
1225 !! endarticle
1227 !! test
1228 Template unnamed parameter
1229 !! input
1230 {{paramtestnum|Main Page|the main page}}
1231 !! result
1232 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
1233 </p>
1234 !! end
1236 !! test
1237 BUG 553: link with two variables in a piped link
1238 !! input
1239 {| 
1240 |[[{{{1}}}|{{{2}}}]]
1242 !! result
1243 <table>
1244 <tr>
1245 <td>[[{{{1}}}|{{{2}}}]]
1246 </td></tr></table>
1248 !! end
1250 !! test
1251 Magic variable as template parameter
1252 !! input
1253 {{paramtest|param={{SITENAME}}}}
1254 !! result
1255 <p>This is a test template with parameter MediaWiki
1256 </p>
1257 !! end
1259 !! article
1260 Template:linktest
1261 !! text
1262 [[{{{param}}}|link]]
1263 !! endarticle
1265 !! test
1266 Template parameter as link source
1267 !! input
1268 {{linktest|param=Main Page}}
1269 !! result
1270 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
1271 </p>
1272 !! end
1275 !!article
1276 Template:paramtest2
1277 !! text
1278 including another template, {{paramtest|param={{{arg}}}}}
1279 !! endarticle
1281 !! test
1282 Template passing argument to another template
1283 !! input
1284 {{paramtest2|arg='hmm'}}
1285 !! result
1286 <p>including another template, This is a test template with parameter 'hmm'
1287 </p>
1288 !! end
1290 !! article
1291 Template:Linktest2
1292 !! text
1293 Main Page
1294 !! endarticle
1296 !! test
1297 Template as link source
1298 !! input
1299 [[{{linktest2}}]]
1300 !! result
1301 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1302 </p>
1303 !! end
1306 !! article
1307 Template:loop1
1308 !! text
1309 {{loop2}}
1310 !! endarticle
1312 !! article
1313 Template:loop2
1314 !! text
1315 {{loop1}}
1316 !! endarticle
1318 !! test
1319 Template infinite loop
1320 !! input
1321 {{loop1}}
1322 !! result
1323 <p>{{loop1}}<!-- WARNING: template loop detected -->
1324 </p>
1325 !! end
1327 !! test
1328 Template from main namespace
1329 !! input
1330 {{:Main Page}}
1331 !! result
1332 <p>blah blah
1333 </p>
1334 !! end
1336 !! article
1337 Template:table
1338 !! text
1339 {| 
1340 | 1 || 2
1341 |- 
1342 | 3 || 4
1344 !! endarticle
1346 !! test
1347 BUG 529: Template with table, not included at beginning of line
1348 !! input
1349 foo {{table}}
1350 !! result
1351 <p>foo 
1352 </p>
1353 <table>
1354 <tr>
1355 <td> 1 </td><td> 2
1356 </td></tr>
1357 <tr>
1358 <td> 3 </td><td> 4
1359 </td></tr></table>
1361 !! end
1363 !! test
1364 BUG 523: Template shouldn't eat newline (or add an extra one before table)
1365 !! input
1367 {{table}}
1368 !! result
1369 <p>foo
1370 </p>
1371 <table>
1372 <tr>
1373 <td> 1 </td><td> 2
1374 </td></tr>
1375 <tr>
1376 <td> 3 </td><td> 4
1377 </td></tr></table>
1379 !! end
1381 !! test
1382 BUG 41: Template parameters shown as broken links
1383 !! input
1384 {{{parameter}}}
1385 !! result
1386 <p>{{{parameter}}}
1387 </p>
1388 !! end
1391 !! article
1392 Template:MSGNW test
1393 !! text
1394 ''None'' of '''this''' should be 
1395 * interepreted
1396  but rather passed unmodified
1397 {{test}}
1398 !! endarticle
1400 # hmm, fix this or just deprecate msgnw and document its behavior?
1401 !! test
1402 msgnw keyword
1403 !! options
1404 disabled
1405 !! input
1406 {{msgnw:MSGNW test}}
1407 !! result
1408 <p>''None'' of '''this''' should be 
1409 * interepreted
1410  but rather passed unmodified
1411 {{test}}
1412 </p>
1413 !! end
1415 !! test
1416 int keyword
1417 !! input
1418 {{int:newmessages|lots of money}}
1419 !! result
1420 <p>You have lots of money.
1421 </p>
1422 !! end
1425 ### Pre-save transform tests
1427 !! test
1428 pre-save transform: subst:
1429 !! options
1431 !! input
1432 {{subst:test}}
1433 !! result
1434 This is a test template
1435 !! end
1437 !! test
1438 pre-save transform: normal template
1439 !! options
1441 !! input
1442 {{test}}
1443 !! result
1444 {{test}}
1445 !! end
1447 !! test
1448 pre-save transform: nonexistant template
1449 !! options
1451 !! input
1452 {{thistemplatedoesnotexist}}
1453 !! result
1454 {{thistemplatedoesnotexist}}
1455 !! end
1458 !! test
1459 pre-save transform: subst magic variables
1460 !! options
1462 !! input
1463 {{subst:SITENAME}}
1464 !! result
1465 MediaWiki
1466 !! end
1468 # This is bug 89, which I fixed. -- wtm
1469 !! test
1470 pre-save transform: subst: templates with parameters
1471 !! options
1473 !! input
1474 {{subst:paramtest|param="something else"}}
1475 !! result
1476 This is a test template with parameter "something else"
1477 !! end
1480 !! article
1481 Template:nowikitest
1482 !! text
1483 <nowiki>'''not wiki'''</nowiki>
1484 !! endarticle
1486 !! test
1487 pre-save transform: nowiki in subst (bug 1188)
1488 !! options
1490 !! input
1491 {{subst:nowikitest}}
1492 !! result
1493 <nowiki>'''not wiki'''</nowiki>
1494 !! end
1497 !! article
1498 Template:commenttest
1499 !! text
1500 This template has <!-- a comment --> in it.
1501 !! endarticle
1503 !! test
1504 pre-save transform: comment in subst (bug 1936)
1505 !! options
1507 !! input
1508 {{subst:commenttest}}
1509 !! result
1510 This template has <!-- a comment --> in it.
1511 !! end
1514 !! article
1515 Template:dangerous
1516 !!text
1517 <span onmouseover="alert('crap')">Oh no</span>
1518 !!endarticle
1520 !!test
1521 (confirming safety of fix for subst bug 1936)
1522 !! input
1523 {{Template:dangerous}}
1524 !! result
1525 <p><span>Oh no</span>
1526 </p>
1527 !! end
1531 ### Message transform tests
1533 !! test
1534 message transform: magic variables
1535 !! options
1537 !! input
1538 {{SITENAME}}
1539 !! result
1540 MediaWiki
1541 !! end
1543 !! test
1544 message transform: should not transform wiki markup
1545 !! options
1547 !! input
1548 ''test''
1549 !! result
1550 ''test''
1551 !! end
1554 ### Images
1556 !! test
1557 Simple image
1558 !! input
1559 [[Image:foobar.jpg]]
1560 !! result
1561 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="Image:foobar.jpg"><img src="/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" /></a>
1562 </p>
1563 !! end
1565 !! test
1566 Right-aligned image
1567 !! input
1568 [[Image:foobar.jpg|right]]
1569 !! result
1570 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title=""><img src="/images/3/3a/Foobar.jpg" alt="" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
1572 !! end
1574 !! test
1575 Image with caption
1576 !! input
1577 [[Image:foobar.jpg|right|Caption text]]
1578 !! result
1579 <div class="floatright"><span><a href="/wiki/Image:Foobar.jpg" class="image" title="Caption text"><img src="/images/3/3a/Foobar.jpg" alt="Caption text" longdesc="/wiki/Image:Foobar.jpg" /></a></span></div>
1581 !! end
1583 !! test
1584 Image with frame and link
1585 !! input
1586 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1587 !! result
1588 <div class="thumb tleft"><div style="width:1943px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image Main Page"><img src="/images/3/3a/Foobar.jpg" alt="This is a test image Main Page" width="1941" height="220" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" >This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
1590 !! end
1592 !! test
1593 Link to image page
1594 !! input
1595 [[:Image:test]]
1596 !! result
1597 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1598 </p>
1599 !! end
1601 !! test
1602 Frameless image caption with a free URL
1603 !! input
1604 [[Image:foobar.jpg|http://example.com]]
1605 !! result
1606 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="http://example.com"><img src="/images/3/3a/Foobar.jpg" alt="http://example.com" longdesc="/wiki/Image:Foobar.jpg" /></a>
1607 </p>
1608 !! end
1610 !! test
1611 Thumbnail image caption with a free URL
1612 !! input
1613 [[Image:foobar.jpg|thumb|http://example.com]]
1614 !! result
1615 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img src="/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="http://example.com" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></a></div><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a></div></div></div>
1617 !! end
1619 # Pending resolution to bug 368
1620 !! test
1621 BUG 648: Frameless image caption with a link
1622 !! input
1623 [[Image:foobar.jpg|text with a [[link]] in it]]
1624 !! result
1625 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="text with a link in it"><img src="/images/3/3a/Foobar.jpg" alt="text with a link in it" longdesc="/wiki/Image:Foobar.jpg" /></a>
1626 </p>
1627 !! end
1629 !! test
1630 Escape HTML special chars in image alt text
1631 !! input
1632 [[Image:foobar.jpg|& < > "]]
1633 !! result
1634 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img src="/images/3/3a/Foobar.jpg" alt="&amp; &lt; &gt; &quot;" longdesc="/wiki/Image:Foobar.jpg" /></a>
1635 </p>
1636 !! end
1638 !! test
1639 BUG 499: Alt text should have &#1234;, not &amp;1234;
1640 !! input
1641 [[Image:foobar.jpg|&#9792;]]
1642 !! result
1643 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="&#9792;"><img src="/images/3/3a/Foobar.jpg" alt="&#9792;" longdesc="/wiki/Image:Foobar.jpg" /></a>
1644 </p>
1645 !! end
1647 !! test
1648 Broken image caption with link
1649 !! input
1650 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
1651 !! result
1652 <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.
1653 </p>
1654 !! end
1656 !! test
1657 Image caption containing another image
1658 !! input
1659 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
1660 !! result
1661 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a caption with another Image:Icon.png inside it!"><img src="/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" alt="This is a caption with another Image:Icon.png inside it!" width="180" height="20" longdesc="/wiki/Image:Foobar.jpg" /></a>  <div class="thumbcaption" ><div class="magnify" style="float:right"><a href="/wiki/Image:Foobar.jpg" class="internal" title="Enlarge"><img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="Enlarge" /></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>
1663 !! end
1665 !! test
1666 Image caption containing a newline
1667 !! input
1668 [[Image:Foobar.jpg|This
1669 *is some text]]
1670 !! result
1671 <p><a href="/wiki/Image:Foobar.jpg" class="image" title="This *is some text"><img src="/images/3/3a/Foobar.jpg" alt="This *is some text" longdesc="/wiki/Image:Foobar.jpg" /></a>
1672 </p>
1673 !!end
1678 ### Subpages
1680 !! article
1681 Subpage test/subpage
1682 !! text
1684 !! endarticle
1686 !! test
1687 Subpage link
1688 !! options
1689 subpage title=[[Subpage test]]
1690 !! input
1691 [[/subpage]]
1692 !! result
1693 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1694 </p>
1695 !! end
1697 !! test
1698 Subpage noslash link
1699 !! options
1700 subpage title=[[Subpage test]]
1701 !!input
1702 [[/subpage/]]
1703 !! result
1704 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1705 </p>
1706 !! end
1708 !! test
1709 Disabled subpages
1710 !! input
1711 [[/subpage]]
1712 !! result
1713 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
1714 </p>
1715 !! end
1717 !! test
1718 BUG 561: {{/Subpage}}
1719 !! options
1720 subpage title=[[Page]]
1721 !! input
1722 {{/Subpage}}
1723 !! result
1724 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
1725 </p>
1726 !! end
1729 ### Categories
1731 !! article
1732 Category:MediaWiki User's Guide
1733 !! text
1734 blah
1735 !! endarticle
1737 !! test
1738 Link to category
1739 !! input
1740 [[:Category:MediaWiki User's Guide]]
1741 !! result
1742 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1743 </p>
1744 !! end
1746 !! test
1747 Simple category
1748 !! options
1750 !! input
1751 [[Category: MediaWiki User's Guide]]
1752 !! result
1753 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1754 !! end
1757 ### Inter-language links
1759 !! test
1760 Inter-language links
1761 !! options
1763 !! input
1764 [[es:Alimento]]
1765 [[fr:Nourriture]]
1766 [[zh:&#39135;&#21697;]]
1767 !! result
1768 es:Alimento fr:Nourriture zh:食品
1769 !! end
1772 ### Sections
1774 !! test
1775 Basic section headings
1776 !! options
1777 title=[[Parser test script]]
1778 !! input
1779 == Headline 1 ==
1780 Some text
1782 ==Headline 2==
1783 More
1784 ===Smaller headline===
1785 Blah blah
1786 !! result
1787 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1788 <p>Some text
1789 </p>
1790 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2>Headline 2</h2>
1791 <p>More
1792 </p>
1793 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Smaller_headline"></a><h3>Smaller headline</h3>
1794 <p>Blah blah
1795 </p>
1796 !! end
1798 !! test
1799 Section headings with TOC
1800 !! options
1801 title=[[Parser test script]]
1802 !! input
1803 == Headline 1 ==
1804 === Subheadline 1 ===
1805 ===== Skipping a level =====
1806 ====== Skipping a level ======
1808 == Headline 2 ==
1809 Some text
1810 ===Another headline===
1811 !! result
1812 <div id='toc'>
1813 <div id='toctitle'><h2>Table of contents</h2></div>
1814 <ul>
1815 <li class='toclevel-1'><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
1816 <ul>
1817 <li class='toclevel-2'><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
1818 <ul>
1819 <li class='toclevel-3'><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
1820 <ul>
1821 <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>
1822 </ul>
1823 </li>
1824 </ul>
1825 </li>
1826 </ul>
1827 </li>
1828 <li class='toclevel-1'><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
1829 <ul>
1830 <li class='toclevel-2'><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
1831 </ul>
1832 </li>
1833 </ul>
1834 </div>
1835 <script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide";  showTocToggle(); } </script><div class='visualClear'></div>
1836 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Headline_1"></a><h2> Headline 1 </h2>
1837 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Subheadline_1"></a><h3> Subheadline 1 </h3>
1838 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=3" title="Parser test script">edit</a>]</div><a name="Skipping_a_level"></a><h5> Skipping a level </h5>
1839 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=4" title="Parser test script">edit</a>]</div><a name="Skipping_a_level_2"></a><h6> Skipping a level </h6>
1840 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=5" title="Parser test script">edit</a>]</div><a name="Headline_2"></a><h2> Headline 2 </h2>
1841 <p>Some text
1842 </p>
1843 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=6" title="Parser test script">edit</a>]</div><a name="Another_headline"></a><h3>Another headline</h3>
1845 !! end
1847 !! test
1848 Resolving duplicate section names
1849 !! options
1850 title=[[Parser test script]]
1851 !! input
1852 == Foo bar ==
1853 ==Foo bar==
1854 !! result
1855 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Foo_bar"></a><h2> Foo bar </h2>
1856 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Foo_bar_2"></a><h2>Foo bar</h2>
1858 !! end
1860 !! article
1861 Template:sections
1862 !! text
1863 ===Section 1===
1864 ==Section 2==
1865 !! endarticle
1867 !! test
1868 Template with sections, __NOTOC__
1869 !! options
1870 title=[[Parser test script]]
1871 !! input
1872 __NOTOC__
1873 ==Section 0==
1874 {{sections}}
1875 ==Section 4==
1876 !! result
1877 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Section_0"></a><h2>Section 0</h2>
1878 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=1" title="Template:Sections">edit</a>]</div><a name="Section_1"></a><h3>Section 1</h3>
1879 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=2" title="Template:Sections">edit</a>]</div><a name="Section_2"></a><h2>Section 2</h2>
1880 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=2" title="Parser test script">edit</a>]</div><a name="Section_4"></a><h2>Section 4</h2>
1882 !! end
1884 !! test
1885 __NOEDITSECTION__ keyword
1886 !! input
1887 __NOEDITSECTION__
1888 ==Section 1==
1889 ==Section 2==
1890 !! result
1891 <a name="Section_1"></a><h2>Section 1</h2>
1892 <a name="Section_2"></a><h2>Section 2</h2>
1894 !! end
1896 !! test
1897 Link inside a section heading
1898 !! options
1899 title=[[Parser test script]]
1900 !! input
1901 ==Section with a [[Main Page|link]] in it==
1902 !! result
1903 <div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=Parser_test_script&amp;action=edit&amp;section=1" title="Parser test script">edit</a>]</div><a name="Section_with_a_link_in_it"></a><h2>Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</h2>
1905 !! end
1908 !! test
1909 Bug 1219 URL next to image (good)
1910 !! input
1911 http://example.com [[Image:foobar.jpg]]
1912 !! result
1913 <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 src="/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" /></a>
1914 </p>
1915 !!end
1917 !! test
1918 Bug 1219 URL next to image (broken)
1919 !! input
1920 http://example.com[[Image:foobar.jpg]]
1921 !! result
1922 <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 src="/images/3/3a/Foobar.jpg" alt="Image:foobar.jpg" longdesc="/wiki/Image:Foobar.jpg" /></a>
1923 </p>
1924 !!end
1926 !! test
1927 Bug 1186 news: in the middle of text
1928 !! input
1929 http://en.wikinews.org/wiki/Wikinews:Workplace
1930 !! result
1931 <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>
1932 </p>
1933 !!end
1936 !! test
1937 Namespaced link must have a title
1938 !! input
1939 [[Project:]]
1940 !! result
1941 <p>[[Project:]]
1942 </p>
1943 !!end
1945 !! test
1946 Namespaced link must have a title (bad fragment version)
1947 !! input
1948 [[Project:#fragment]]
1949 !! result
1950 <p>[[Project:#fragment]]
1951 </p>
1952 !!end
1955 !! test
1956 div with no attributes
1957 !! input
1958 <div>HTML rocks</div>
1959 !! result
1960 <div>HTML rocks</div>
1962 !! end
1964 !! test
1965 div with double-quoted attribute
1966 !! input
1967 <div id="rock">HTML rocks</div>
1968 !! result
1969 <div id="rock">HTML rocks</div>
1971 !! end
1973 !! test
1974 div with single-quoted attribute
1975 !! input
1976 <div id='rock'>HTML rocks</div>
1977 !! result
1978 <div id="rock">HTML rocks</div>
1980 !! end
1982 !! test
1983 div with unquoted attribute
1984 !! input
1985 <div id=rock>HTML rocks</div>
1986 !! result
1987 <div id="rock">HTML rocks</div>
1989 !! end
1991 !! test
1992 div with illegal double attributes
1993 !! input
1994 <div align="center" align="right">HTML rocks</div>
1995 !! result
1996 <div align="center">HTML rocks</div>
1998 !!end
2000 !! test
2001 DIV IN UPPERCASE
2002 !! input
2003 <DIV ALIGN="center">HTML ROCKS</DIV>
2004 !! result
2005 <div align="center">HTML ROCKS</div>
2007 !!end
2010 !! test
2011 text with amp in the middle of nowhere
2012 !! input
2013 Remember AT&T?
2014 !!result
2015 <p>Remember AT&amp;T?
2016 </p>
2017 !! end
2019 !! test
2020 text with character entity: eacute
2021 !! input
2022 I always thought &eacute; was a cute letter.
2023 !! result
2024 <p>I always thought &eacute; was a cute letter.
2025 </p>
2026 !! end
2028 !! test
2029 text with undefined character entity: xacute
2030 !! input
2031 I always thought &xacute; was a cute letter.
2032 !! result
2033 <p>I always thought &amp;xacute; was a cute letter.
2034 </p>
2035 !! end
2038 !! test
2039 Media link
2040 !! input
2041 [[Media:Foobar.jpg]]
2042 !! result
2043 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Media:Foobar.jpg</a>
2044 </p>
2045 !! end
2047 !! test
2048 Media link with text
2049 !! input
2050 [[Media:Foobar.jpg|A neat file to look at]]
2051 !! result
2052 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">A neat file to look at</a>
2053 </p>
2054 !! end
2056 # FIXME: this is still bad HTML tag nesting
2057 !! test
2058 Media link with nasty text
2059 !! input
2060 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
2061 !! result
2062 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Safe Link<div style="display:none">" onmouseover="alert(document.cookie) onfoo="</div></a>
2063 </p>
2064 !! end
2067 !! test
2068 Character reference normalization in link text (bug 1938)
2069 !! input
2070 [[Main Page|this&that]]
2071 !! result
2072 <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
2073 </p>
2074 !!end
2076 TODO:
2077 more images
2078 more tables
2079 math
2080 character entities
2081 and much more