Moving EXIF data retrieval to Image class
[mediawiki.git] / maintenance / parserTests.txt
blob51203a5ceb4251fc3a5f21ae34537149cbeaa669
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="http://en.wikipedia.org/wiki/FAQ" class='extiw' 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 289: ">"-token in URL-tail
539 !! input
540 http://www.example.com/<hello>
541 !! result
542 <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;
543 </p>
544 !!end
546 !! test
547 BUG 289: literal ">"-token in URL-tail
548 !! input
549 http://www.example.com/<b>html</b>
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><b>html</b>
552 </p>
553 !!end
555 !! test
556 BUG 289: ">"-token in bracketed URL
557 !! input
558 [http://www.example.com/<hello> stuff]
559 !! result
560 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">&lt;hello&gt; stuff</a>
561 </p>
562 !!end
564 !! test
565 BUG 289: literal ">"-token in bracketed URL
566 !! input
567 [http://www.example.com/<b>html</b> stuff]
568 !! result
569 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow"><b>html</b> stuff</a>
570 </p>
571 !!end
573 !! test
574 BUG 289: literal double quote at end of URL
575 !! input
576 http://www.example.com/"hello"
577 !! result
578 <p><a href="http://www.example.com/" class='external free' title="http://www.example.com/" rel="nofollow">http://www.example.com/</a>"hello"
579 </p>
580 !!end
582 !! test
583 BUG 289: literal double quote in bracketed URL
584 !! input
585 [http://www.example.com/"hello" stuff]
586 !! result
587 <p><a href="http://www.example.com/" class='external text' title="http://www.example.com/" rel="nofollow">"hello" stuff</a>
588 </p>
589 !!end
591 !! test
592 External links: invalid character
593 !! input
594 [http://www.example.com\0 test]
595 !! result
596 <p>[<a href="http://www.example.com" class='external free' title="http://www.example.com" rel="nofollow">http://www.example.com</a>\0 test]
597 </p>
598 !! end
601 ### Quotes
604 !! test
605 Quotes
606 !! input
607 Normal text. '''Bold text.''' Normal text. ''Italic text.''
609 Normal text. '''''Bold italic text.''''' Normal text.
610 !!result
611 <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
612 </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
613 </p>
614 !! end
617 !! test
618 Unclosed and unmatched quotes
619 !! input
620 '''''Bold italic text '''with bold deactivated''' in between.'''''
622 '''''Bold italic text ''with italic deactivated'' in between.'''''
624 '''Bold text..
626 ..spanning two paragraphs (should not work).'''
628 '''Bold tag left open
630 ''Italic tag left open
632 Normal text.
634 <!-- Unmatching number of opening, closing tags: -->
635 '''This year''''s election ''should'' beat '''last year''''s.
637 ''Tom'''s car is bigger than ''Susan'''s.
638 !! result
639 <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
640 </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
641 </p><p><b>Bold text..</b>
642 </p><p>..spanning two paragraphs (should not work).<b></b>
643 </p><p><b>Bold tag left open</b>
644 </p><p><i>Italic tag left open</i>
645 </p><p>Normal text.
646 </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
647 </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
648 </p>
649 !! end
652 ### Tables
654 ### content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
656 !! test
657 Simple table
658 !! input
659 {| 
660 | 1 || 2
661 |- 
662 | 3 || 4
664 !! result
665 <table>
666 <tr>
667 <td> 1 </td><td> 2
668 </td></tr>
669 <tr>
670 <td> 3 </td><td> 4
671 </td></tr></table>
673 !! end
675 !! test
676 Multiplication table
677 !! input
678 {| border="1" cellpadding="2"
679 |+Multiplication table
681 ! &times; !! 1 !! 2 !! 3
683 ! 1
684 | 1 || 2 || 3
686 ! 2
687 | 2 || 4 || 6
689 ! 3
690 | 3 || 6 || 9
692 ! 4
693 | 4 || 8 || 12
695 ! 5
696 | 5 || 10 || 15
698 !! result
699 <table border="1" cellpadding="2">
700 <caption>Multiplication table
701 </caption>
702 <tr>
703 <th> &times; </th><th> 1 </th><th> 2 </th><th> 3
704 </th></tr>
705 <tr>
706 <th> 1
707 </th><td> 1 </td><td> 2 </td><td> 3
708 </td></tr>
709 <tr>
710 <th> 2
711 </th><td> 2 </td><td> 4 </td><td> 6
712 </td></tr>
713 <tr>
714 <th> 3
715 </th><td> 3 </td><td> 6 </td><td> 9
716 </td></tr>
717 <tr>
718 <th> 4
719 </th><td> 4 </td><td> 8 </td><td> 12
720 </td></tr>
721 <tr>
722 <th> 5
723 </th><td> 5 </td><td> 10 </td><td> 15
724 </td></tr></table>
726 !! end
728 !! test
729 Table rowspan
730 !! input
731 {| align=right border=1
732 | Cell 1, row 1 
733 |rowspan=2| Cell 2, row 1 (and 2) 
734 | Cell 3, row 1 
735 |- 
736 | Cell 1, row 2 
737 | Cell 3, row 2 
739 !! result
740 <table align="right" border="1">
741 <tr>
742 <td> Cell 1, row 1
743 </td><td rowspan="2"> Cell 2, row 1 (and 2)
744 </td><td> Cell 3, row 1
745 </td></tr>
746 <tr>
747 <td> Cell 1, row 2
748 </td><td> Cell 3, row 2
749 </td></tr></table>
751 !! end
753 !! test
754 Nested table
755 !! input
756 {| border=1
757 | &alpha;
759 {| bgcolor=#ABCDEF border=2
760 |nested
762 |table
764 |the original table again
766 !! result
767 <table border="1">
768 <tr>
769 <td> &alpha;
770 </td><td>
771 <table bgcolor="#ABCDEF" border="2">
772 <tr>
773 <td>nested
774 </td></tr>
775 <tr>
776 <td>table
777 </td></tr></table>
778 </td><td>the original table again
779 </td></tr></table>
781 !! end
784 ### Internal links
786 !! test
787 Plain link, capitalized
788 !! input
789 [[Main Page]]
790 !! result
791 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
792 </p>
793 !! end
795 !! test
796 Plain link, uncapitalized
797 !! input
798 [[main Page]]
799 !! result
800 <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
801 </p>
802 !! end
804 !! test
805 Piped link
806 !! input
807 [[Main Page|The Main Page]]
808 !! result
809 <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
810 </p>
811 !! end
813 !! test
814 Broken link
815 !! input
816 [[Zigzagzogzagzig]]
817 !! result
818 <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
819 </p>
820 !! end
822 !! test
823 Link with prefix
824 !! input
825 xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
826 !! result
827 <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>
828 </p>
829 !! end
831 !! test
832 Link with suffix
833 !! input
834 [[Main Page]]xxx, [[Main Page]]XXX
835 !! result
836 <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
837 </p>
838 !! end
840 !! test
841 Link with 3 brackets
842 !! input
843 [[[main page]]]
844 !! result
845 <p>[[[main page]]]
846 </p>
847 !! end
849 !! test
850 Piped link with 3 brackets
851 !! input
852 [[[main page|the main page]]]
853 !! result
854 <p>[[[main page|the main page]]]
855 </p>
856 !! end
858 !! test
859 Link to namespaces
860 !! input
861 [[Talk:Parser testing]], [[Meta:Disclaimers]]
862 !! result
863 <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>
864 </p>
865 !! end
867 !! test
868 Piped link to namespace
869 !! input
870 [[Meta:Disclaimers|The disclaimers]]
871 !! result
872 <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
873 </p>
874 !! end
876 !! test
877 Link containing }
878 !! input
879 [[Usually caused by a typo (oops}]]
880 !! result
881 <p>[[Usually caused by a typo (oops}]]
882 </p>
883 !! end
885 !! test
886 Link containing % (not as a hex sequence)
887 !! input
888 [[7% Solution]]
889 !! result
890 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
891 </p>
892 !! end
894 !! test
895 Link containing % as a single hex sequence interpreted to char
896 !! input
897 [[7%25 Solution]]
898 !! result
899 <p><a href="/index.php?title=7%25_Solution&amp;action=edit" class="new" title="7% Solution">7% Solution</a>
900 </p>
901 !!end
903 !! test
904 Link containing % as a double hex sequence interpreted to hex sequence
905 !! input
906 [[7%2525 Solution]]
907 !! result
908 <p>[[7%2525 Solution]]
909 </p>
910 !!end
912 !! test
913 Plain link to URL
914 !! input
915 [[http://www.example.org]]
916 !! result
917 <p>[<a href="http://www.example.org" class='external autonumber' title="http://www.example.org" rel="nofollow">[1]</a>]
918 </p>
919 !! end
921 # I'm fairly sure the expected result here is wrong.
922 # We want these to be URL links, not pseudo-pages with URLs for titles....
923 # However the current output is also pretty screwy.
925 # ----
926 # I'm changing it to match the current output--it arguably makes more
927 # sense in the light of the test above. Old expected result was:
928 #<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>
929 #</p>
930 # But I think this test is bordering on "garbage in, garbage out" anyway.
931 # -- wtm
932 !! test
933 Piped link to URL
934 !! input
935 Piped link to URL: [[http://www.example.org|an example URL]]
936 !! result
937 <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>]
938 </p>
939 !! end
941 !! test
942 BUG 2: [[page|http://url/]] should link to page, not http://url/
943 !! input
944 [[Main Page|http://url/]]
945 !! result
946 <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
947 </p>
948 !! end
950 !! test
951 BUG 337: Escaped self-links should be bold
952 !! options
953 title=[[Bug462]]
954 !! input
955 [[Bu&#103;462]] [[Bug462]]
956 !! result
957 <p><strong>Bu&#103;462</strong> <strong>Bug462</strong>
958 </p>
959 !! end
961 !! test
962 Self-link to section should not be bold
963 !! options
964 title=[[Main Page]]
965 !! input
966 [[Main Page#section]]
967 !! result
968 <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
969 </p>
970 !! end
972 !! test
973 <nowiki> inside a link
974 !! input
975 [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
976 !! result
977 <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>
978 </p>
979 !! end
982 ### Interwiki links (see maintenance/interwiki.sql)
985 !! test
986 Inline interwiki link
987 !! input
988 [[MeatBall:SoftSecurity]]
989 !! result
990 <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class='extiw' title="MeatBall:SoftSecurity">MeatBall:SoftSecurity</a>
991 </p>
992 !! end
994 !! test
995 Interwiki link encoding conversion (bug 1636)
996 !! input
997 *[[Wikipedia:ro:Olteni&#0355;a]]
998 *[[Wikipedia:ro:Olteni&#355;a]]
999 !! result
1000 <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class='extiw' title="Wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#0355;a</a>
1001 </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>
1002 </li></ul>
1004 !! end
1007 ## XHTML tidiness
1010 !! test
1011 <br> to <br />
1012 !! input
1013 1<br>2<br />3
1014 !! result
1015 <p>1<br />2<br />3
1016 </p>
1017 !! end
1020 ### Block-level elements
1022 !! test
1023 Common list
1024 !! input
1025 *Common list
1026 * item 2
1027 *item 3
1028 !! result
1029 <ul><li>Common list
1030 </li><li> item 2
1031 </li><li>item 3
1032 </li></ul>
1034 !! end
1036 !! test
1037 Numbered list
1038 !! input
1039 #Numbered list
1040 #item 2
1041 # item 3
1042 !! result
1043 <ol><li>Numbered list
1044 </li><li>item 2
1045 </li><li> item 3
1046 </li></ol>
1048 !! end
1050 !! test
1051 Mixed list
1052 !! input
1053 *Mixed list
1054 *# with numbers
1055 ** and bullets
1056 *# and numbers
1057 *bullets again
1058 **bullet level 2
1059 ***bullet level 3
1060 ***#Number on level 4
1061 **bullet level 2
1062 **#Number on level 3
1063 **#Number on level 3
1064 *#number level 2
1065 *Level 1
1066 !! result
1067 <ul><li>Mixed list
1068 <ol><li> with numbers
1069 </li></ol>
1070 <ul><li> and bullets
1071 </li></ul>
1072 <ol><li> and numbers
1073 </li></ol>
1074 </li><li>bullets again
1075 <ul><li>bullet level 2
1076 <ul><li>bullet level 3
1077 <ol><li>Number on level 4
1078 </li></ol>
1079 </li></ul>
1080 </li><li>bullet level 2
1081 <ol><li>Number on level 3
1082 </li><li>Number on level 3
1083 </li></ol>
1084 </li></ul>
1085 <ol><li>number level 2
1086 </li></ol>
1087 </li><li>Level 1
1088 </li></ul>
1090 !! end
1093 ### Magic variables
1095 !! test
1096 Magic variables
1097 !! input
1098 {{SITENAME}}
1099 !! result
1100 <p>MediaWiki
1101 </p>
1102 !! end
1105 ### Magic links
1107 !! test
1108 Magic links: internal link to RFC
1109 !! input
1110 [[RFC 123]]
1111 !! result
1112 <p><a href="/index.php?title=RFC_123&amp;action=edit" class="new" title="RFC 123">RFC 123</a>
1113 </p>
1114 !! end
1116 !! test
1117 Magic links: RFC
1118 !! input
1119 RFC 822
1120 !! result
1121 <p><a href='http://www.faqs.org/rfcs/rfc822.html' class='external' title="http://www.faqs.org/rfcs/rfc822.html">RFC 822</a>
1122 </p>
1123 !! end
1125 !! test
1126 Magic links: ISBN (bug 1937)
1127 !! input
1128 ISBN 0-306-40615-2
1129 !! result
1130 <p><a href="/index.php?title=Special:Booksources&amp;isbn=0306406152" class="internal">ISBN 0-306-40615-2</a>
1131 </p>
1132 !! end
1134 !! test
1135 Magic links: PMID
1136 !! input
1137 PMID 1234
1138 !! result
1139 <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&db=pubmed&dopt=Abstract&list_uids=1234">PMID 1234</a>
1140 </p>
1141 !! end
1144 ### Templates
1145 ####
1147 !! test
1148 Nonexistant template
1149 !! input
1150 {{thistemplatedoesnotexist}}
1151 !! result
1152 <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit" class="new" title="Template:Thistemplatedoesnotexist">Template:Thistemplatedoesnotexist</a>
1153 </p>
1154 !! end
1156 !! article
1157 Template:test
1158 !! text
1159 This is a test template
1160 !! endarticle
1162 !! test
1163 Simple template
1164 !! input
1165 {{test}}
1166 !! result
1167 <p>This is a test template
1168 </p>
1169 !! end
1171 !! test
1172 Template with explicit namespace
1173 !! input
1174 {{Template:test}}
1175 !! result
1176 <p>This is a test template
1177 </p>
1178 !! end
1181 !! article
1182 Template:paramtest
1183 !! text
1184 This is a test template with parameter {{{param}}}
1185 !! endarticle
1187 !! test
1188 Template parameter
1189 !! input
1190 {{paramtest|param=foo}}
1191 !! result
1192 <p>This is a test template with parameter foo
1193 </p>
1194 !! end
1196 !! article
1197 Template:paramtestnum
1198 !! text
1199 [[{{{1}}}|{{{2}}}]]
1200 !! endarticle
1202 !! test
1203 Template unnamed parameter
1204 !! input
1205 {{paramtestnum|Main Page|the main page}}
1206 !! result
1207 <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
1208 </p>
1209 !! end
1211 !! test
1212 BUG 553: link with two variables in a piped link
1213 !! input
1214 {| 
1215 |[[{{{1}}}|{{{2}}}]]
1217 !! result
1218 <table>
1219 <tr>
1220 <td>[[{{{1}}}|{{{2}}}]]
1221 </td></tr></table>
1223 !! end
1225 !! test
1226 Magic variable as template parameter
1227 !! input
1228 {{paramtest|param={{SITENAME}}}}
1229 !! result
1230 <p>This is a test template with parameter MediaWiki
1231 </p>
1232 !! end
1234 !! article
1235 Template:linktest
1236 !! text
1237 [[{{{param}}}|link]]
1238 !! endarticle
1240 !! test
1241 Template parameter as link source
1242 !! input
1243 {{linktest|param=Main Page}}
1244 !! result
1245 <p><a href="/wiki/Main_Page" title="Main Page">link</a>
1246 </p>
1247 !! end
1250 !!article
1251 Template:paramtest2
1252 !! text
1253 including another template, {{paramtest|param={{{arg}}}}}
1254 !! endarticle
1256 !! test
1257 Template passing argument to another template
1258 !! input
1259 {{paramtest2|arg='hmm'}}
1260 !! result
1261 <p>including another template, This is a test template with parameter 'hmm'
1262 </p>
1263 !! end
1265 !! article
1266 Template:Linktest2
1267 !! text
1268 Main Page
1269 !! endarticle
1271 !! test
1272 Template as link source
1273 !! input
1274 [[{{linktest2}}]]
1275 !! result
1276 <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
1277 </p>
1278 !! end
1281 !! article
1282 Template:loop1
1283 !! text
1284 {{loop2}}
1285 !! endarticle
1287 !! article
1288 Template:loop2
1289 !! text
1290 {{loop1}}
1291 !! endarticle
1293 !! test
1294 Template infinite loop
1295 !! input
1296 {{loop1}}
1297 !! result
1298 <p>{{loop2}}<!-- WARNING: template loop detected -->
1299 </p>
1300 !! end
1302 !! test
1303 Template from main namespace
1304 !! input
1305 {{:Main Page}}
1306 !! result
1307 <p>blah blah
1308 </p>
1309 !! end
1311 !! article
1312 Template:table
1313 !! text
1314 {| 
1315 | 1 || 2
1316 |- 
1317 | 3 || 4
1319 !! endarticle
1321 !! test
1322 BUG 529: Template with table, not included at beginning of line
1323 !! input
1324 foo {{table}}
1325 !! result
1326 <p>foo 
1327 </p>
1328 <table>
1329 <tr>
1330 <td> 1 </td><td> 2
1331 </td></tr>
1332 <tr>
1333 <td> 3 </td><td> 4
1334 </td></tr></table>
1336 !! end
1338 !! test
1339 BUG 523: Template shouldn't eat newline (or add an extra one before table)
1340 !! input
1342 {{table}}
1343 !! result
1344 <p>foo
1345 </p>
1346 <table>
1347 <tr>
1348 <td> 1 </td><td> 2
1349 </td></tr>
1350 <tr>
1351 <td> 3 </td><td> 4
1352 </td></tr></table>
1354 !! end
1356 !! test
1357 BUG 41: Template parameters shown as broken links
1358 !! input
1359 {{{parameter}}}
1360 !! result
1361 <p>{{{parameter}}}
1362 </p>
1363 !! end
1366 !! article
1367 Template:MSGNW test
1368 !! text
1369 ''None'' of '''this''' should be 
1370 * interepreted
1371  but rather passed unmodified
1372 {{test}}
1373 !! endarticle
1375 # hmm, fix this or just deprecate msgnw and document its behavior?
1376 !! test
1377 msgnw keyword
1378 !! options
1379 disabled
1380 !! input
1381 {{msgnw:MSGNW test}}
1382 !! result
1383 <p>''None'' of '''this''' should be 
1384 * interepreted
1385  but rather passed unmodified
1386 {{test}}
1387 </p>
1388 !! end
1390 !! test
1391 int keyword
1392 !! input
1393 {{int:newmessages|lots of money}}
1394 !! result
1395 <p>You have lots of money.
1396 </p>
1397 !! end
1400 ### Pre-save transform tests
1402 !! test
1403 pre-save transform: subst:
1404 !! options
1406 !! input
1407 {{subst:test}}
1408 !! result
1409 This is a test template
1410 !! end
1412 !! test
1413 pre-save transform: normal template
1414 !! options
1416 !! input
1417 {{test}}
1418 !! result
1419 {{test}}
1420 !! end
1422 !! test
1423 pre-save transform: nonexistant template
1424 !! options
1426 !! input
1427 {{thistemplatedoesnotexist}}
1428 !! result
1429 {{thistemplatedoesnotexist}}
1430 !! end
1433 !! test
1434 pre-save transform: subst magic variables
1435 !! options
1437 !! input
1438 {{subst:SITENAME}}
1439 !! result
1440 MediaWiki
1441 !! end
1443 # This is bug 89, which I fixed. -- wtm
1444 !! test
1445 pre-save transform: subst: templates with parameters
1446 !! options
1448 !! input
1449 {{subst:paramtest|param="something else"}}
1450 !! result
1451 This is a test template with parameter "something else"
1452 !! end
1455 !! article
1456 Template:nowikitest
1457 !! text
1458 <nowiki>'''not wiki'''</nowiki>
1459 !! endarticle
1461 !! test
1462 pre-save transform: nowiki in subst (bug 1188)
1463 !! options
1465 !! input
1466 {{subst:nowikitest}}
1467 !! result
1468 <nowiki>'''not wiki'''</nowiki>
1469 !! end
1472 !! article
1473 Template:commenttest
1474 !! text
1475 This template has <!-- a comment --> in it.
1476 !! endarticle
1478 !! test
1479 pre-save transform: comment in subst (bug 1936)
1480 !! options
1482 !! input
1483 {{subst:commenttest}}
1484 !! result
1485 This template has <!-- a comment --> in it.
1486 !! end
1489 !! article
1490 Template:dangerous
1491 !!text
1492 <span onmouseover="alert('crap')">Oh no</span>
1493 !!endarticle
1495 !!test
1496 (confirming safety of fix for subst bug 1936)
1497 !! input
1498 {{Template:dangerous}}
1499 !! result
1500 <p><span>Oh no</span>
1501 </p>
1502 !! end
1506 ### Message transform tests
1508 !! test
1509 message transform: magic variables
1510 !! options
1512 !! input
1513 {{SITENAME}}
1514 !! result
1515 MediaWiki
1516 !! end
1518 !! test
1519 message transform: should not transform wiki markup
1520 !! options
1522 !! input
1523 ''test''
1524 !! result
1525 ''test''
1526 !! end
1529 ### Images
1531 !! test
1532 Simple image
1533 !! input
1534 [[Image:foobar.jpg]]
1535 !! result
1536 <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>
1537 </p>
1538 !! end
1540 !! test
1541 Right-aligned image
1542 !! input
1543 [[Image:foobar.jpg|right]]
1544 !! result
1545 <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>
1547 !! end
1549 !! test
1550 Image with caption
1551 !! input
1552 [[Image:foobar.jpg|right|Caption text]]
1553 !! result
1554 <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>
1556 !! end
1558 !! test
1559 Image with frame and link
1560 !! input
1561 [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
1562 !! result
1563 <div class="thumb tleft"><div style="width:202px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="This is a test image "><img src="/images/3/3a/Foobar.jpg" alt="This is a test image " width="200" height="200" 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>
1565 !! end
1567 !! test
1568 Link to image page
1569 !! input
1570 [[:Image:test]]
1571 !! result
1572 <p><a href="/wiki/Image:Test" title="Image:Test">Image:test</a>
1573 </p>
1574 !! end
1576 !! test
1577 Frameless image caption with a free URL
1578 !! input
1579 [[Image:foobar.jpg|http://example.com]]
1580 !! result
1581 <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>
1582 </p>
1583 !! end
1585 !! test
1586 Thumbnail image caption with a free URL
1587 !! input
1588 [[Image:foobar.jpg|thumb|http://example.com]]
1589 !! result
1590 <div class="thumb tright"><div style="width:182px;"><a href="/wiki/Image:Foobar.jpg" class="internal" title="http://example.com"><img src="/images/3/3a/Foobar.jpg" alt="http://example.com" width="180" height="180" 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' rel="nofollow">http://example.com</a></div></div></div>
1592 !! end
1594 # Pending resolution to bug 368
1595 !! test
1596 BUG 648: Frameless image caption with a link
1597 !! input
1598 [[Image:foobar.jpg|text with a [[link]] in it]]
1599 !! result
1600 <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>
1601 </p>
1602 !! end
1604 !! test
1605 Escape HTML special chars in image alt text
1606 !! input
1607 [[Image:foobar.jpg|& < > "]]
1608 !! result
1609 <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>
1610 </p>
1611 !! end
1613 !! test
1614 BUG 499: Alt text should have &#1234;, not &amp;1234;
1615 !! input
1616 [[Image:foobar.jpg|&#9792;]]
1617 !! result
1618 <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>
1619 </p>
1620 !! end
1622 !! test
1623 Broken image caption with link
1624 !! input
1625 [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
1626 !! result
1627 <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.
1628 </p>
1629 !! end
1631 !! test
1632 Image caption containing another image
1633 !! input
1634 [[Image:Foobar.jpg|thumb|This is a caption with another [[Image:icon.png|image]] inside it!]]
1635 !! result
1636 <div class="thumb tright"><div style="width:182px;"><b>Missing image</b><br /><i>Foobar.jpg</i>   <div class="thumbcaption" >This is a caption with another <a href="/wiki/Image:Icon.png" class="image" title="image"><img src="/images/9/96/Icon.png" alt="image" longdesc="/wiki/Image:Icon.png" /></a> inside it!</div></div></div>
1638 !! end
1640 !! test
1641 Image caption containing a newline
1642 !! input
1643 [[Image:Foobar.jpg|This
1644 *is some text]]
1645 !! result
1646 <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>
1647 </p>
1648 !!end
1653 ### Subpages
1655 !! article
1656 Subpage test/subpage
1657 !! text
1659 !! endarticle
1661 !! test
1662 Subpage link
1663 !! options
1664 subpage title=[[Subpage test]]
1665 !! input
1666 [[/subpage]]
1667 !! result
1668 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
1669 </p>
1670 !! end
1672 !! test
1673 Subpage noslash link
1674 !! options
1675 subpage title=[[Subpage test]]
1676 !!input
1677 [[/subpage/]]
1678 !! result
1679 <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
1680 </p>
1681 !! end
1683 !! test
1684 Disabled subpages
1685 !! input
1686 [[/subpage]]
1687 !! result
1688 <p><a href="/index.php?title=/subpage&amp;action=edit" class="new" title="/subpage">/subpage</a>
1689 </p>
1690 !! end
1692 !! test
1693 BUG 561: {{/Subpage}}
1694 !! options
1695 subpage title=[[Page]]
1696 !! input
1697 {{/Subpage}}
1698 !! result
1699 <p><a href="/index.php?title=Page/Subpage&amp;action=edit" class="new" title="Page/Subpage">Page/Subpage</a>
1700 </p>
1701 !! end
1704 ### Categories
1706 !! article
1707 Category:MediaWiki User's Guide
1708 !! text
1709 blah
1710 !! endarticle
1712 !! test
1713 Link to category
1714 !! input
1715 [[:Category:MediaWiki User's Guide]]
1716 !! result
1717 <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
1718 </p>
1719 !! end
1721 !! test
1722 Simple category
1723 !! options
1725 !! input
1726 [[Category: MediaWiki User's Guide]]
1727 !! result
1728 <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">MediaWiki User's Guide</a>
1729 !! end
1732 ### Inter-language links
1734 !! test
1735 Inter-language links
1736 !! options
1738 !! input
1739 [[es:Alimento]]
1740 [[fr:Nourriture]]
1741 [[zh:&#39135;&#21697;]]
1742 !! result
1743 es:Alimento fr:Nourriture zh:食品
1744 !! end
1747 ### Sections
1749 !! test
1750 Basic section headings
1751 !! options
1752 title=[[Parser test script]]
1753 !! input
1754 == Headline 1 ==
1755 Some text
1757 ==Headline 2==
1758 More
1759 ===Smaller headline===
1760 Blah blah
1761 !! result
1762 <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>
1763 <p>Some text
1764 </p>
1765 <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>
1766 <p>More
1767 </p>
1768 <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>
1769 <p>Blah blah
1770 </p>
1771 !! end
1773 !! test
1774 Section headings with TOC
1775 !! options
1776 title=[[Parser test script]]
1777 !! input
1778 == Headline 1 ==
1779 === Subheadline 1 ===
1780 ===== Skipping a level =====
1781 ====== Skipping a level ======
1783 == Headline 2 ==
1784 Some text
1785 ===Another headline===
1786 !! result
1787 <div id='toc'>
1788 <div id='toctitle'><h2>Table of contents</h2></div>
1789 <ul>
1790 <li class='toclevel-1'><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
1791 <ul>
1792 <li class='toclevel-2'><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
1793 <ul>
1794 <li class='toclevel-3'><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
1795 <ul>
1796 <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>
1797 </ul>
1798 </li>
1799 </ul>
1800 </li>
1801 </ul>
1802 </li>
1803 <li class='toclevel-1'><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
1804 <ul>
1805 <li class='toclevel-2'><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
1806 </ul>
1807 </li>
1808 </ul>
1809 </div>
1810 <script type="text/javascript"> if (window.showTocToggle) { var tocShowText = "show"; var tocHideText = "hide";  showTocToggle(); } </script><div class='visualClear'></div>
1811 <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>
1812 <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>
1813 <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>
1814 <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>
1815 <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>
1816 <p>Some text
1817 </p>
1818 <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>
1820 !! end
1822 !! test
1823 Resolving duplicate section names
1824 !! options
1825 title=[[Parser test script]]
1826 !! input
1827 == Foo bar ==
1828 ==Foo bar==
1829 !! result
1830 <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>
1831 <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>
1833 !! end
1835 !! article
1836 Template:sections
1837 !! text
1838 ===Section 1===
1839 ==Section 2==
1840 !! endarticle
1842 !! test
1843 Template with sections, __NOTOC__
1844 !! options
1845 title=[[Parser test script]]
1846 !! input
1847 __NOTOC__
1848 ==Section 0==
1849 {{sections}}
1850 ==Section 4==
1851 !! result
1852 <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>
1853 <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>
1854 <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>
1855 <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>
1857 !! end
1859 !! test
1860 __NOEDITSECTION__ keyword
1861 !! input
1862 __NOEDITSECTION__
1863 ==Section 1==
1864 ==Section 2==
1865 !! result
1866 <a name="Section_1"></a><h2>Section 1</h2>
1867 <a name="Section_2"></a><h2>Section 2</h2>
1869 !! end
1871 !! test
1872 Link inside a section heading
1873 !! options
1874 title=[[Parser test script]]
1875 !! input
1876 ==Section with a [[Main Page|link]] in it==
1877 !! result
1878 <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>
1880 !! end
1883 !! test
1884 Bug 1219 URL next to image (good)
1885 !! input
1886 http://example.com [[Image:foobar.jpg]]
1887 !! result
1888 <p><a href="http://example.com" class='external free' 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>
1889 </p>
1890 !!end
1892 !! test
1893 Bug 1219 URL next to image (broken)
1894 !! input
1895 http://example.com[[Image:foobar.jpg]]
1896 !! result
1897 <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>
1898 </p>
1899 !!end
1901 !! test
1902 Bug 1186 news: in the middle of text
1903 !! input
1904 http://en.wikinews.org/wiki/Wikinews:Workplace
1905 !! result
1906 <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>
1907 </p>
1908 !!end
1911 !! test
1912 Namespaced link must have a title
1913 !! input
1914 [[Project:]]
1915 !! result
1916 <p>[[Project:]]
1917 </p>
1918 !!end
1920 !! test
1921 Namespaced link must have a title (bad fragment version)
1922 !! input
1923 [[Project:#fragment]]
1924 !! result
1925 <p>[[Project:#fragment]]
1926 </p>
1927 !!end
1930 !! test
1931 div with no attributes
1932 !! input
1933 <div>HTML rocks</div>
1934 !! result
1935 <div>HTML rocks</div>
1937 !! end
1939 !! test
1940 div with double-quoted attribute
1941 !! input
1942 <div id="rock">HTML rocks</div>
1943 !! result
1944 <div id="rock">HTML rocks</div>
1946 !! end
1948 !! test
1949 div with single-quoted attribute
1950 !! input
1951 <div id='rock'>HTML rocks</div>
1952 !! result
1953 <div id="rock">HTML rocks</div>
1955 !! end
1957 !! test
1958 div with unquoted attribute
1959 !! input
1960 <div id=rock>HTML rocks</div>
1961 !! result
1962 <div id="rock">HTML rocks</div>
1964 !! end
1966 !! test
1967 div with illegal double attributes
1968 !! input
1969 <div align="center" align="right">HTML rocks</div>
1970 !! result
1971 <div align="center">HTML rocks</div>
1973 !!end
1975 !! test
1976 DIV IN UPPERCASE
1977 !! input
1978 <DIV ALIGN="center">HTML ROCKS</DIV>
1979 !! result
1980 <div align="center">HTML ROCKS</div>
1982 !!end
1985 !! test
1986 text with amp in the middle of nowhere
1987 !! input
1988 Remember AT&T?
1989 !!result
1990 <p>Remember AT&amp;T?
1991 </p>
1992 !! end
1994 !! test
1995 text with character entity: eacute
1996 !! input
1997 I always thought &eacute; was a cute letter.
1998 !! result
1999 <p>I always thought &eacute; was a cute letter.
2000 </p>
2001 !! end
2003 !! test
2004 text with undefined character entity: xacute
2005 !! input
2006 I always thought &xacute; was a cute letter.
2007 !! result
2008 <p>I always thought &amp;xacute; was a cute letter.
2009 </p>
2010 !! end
2013 !! test
2014 Media link
2015 !! input
2016 [[Media:Foobar.jpg]]
2017 !! result
2018 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">Media:Foobar.jpg</a>
2019 </p>
2020 !! end
2022 !! test
2023 Media link with text
2024 !! input
2025 [[Media:Foobar.jpg|A neat file to look at]]
2026 !! result
2027 <p><a href="/images/3/3a/Foobar.jpg" class='internal' title="Foobar.jpg">A neat file to look at</a>
2028 </p>
2029 !! end
2031 # FIXME: this is still bad HTML tag nesting
2032 !! test
2033 Media link with nasty text
2034 !! input
2035 [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
2036 !! result
2037 <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>
2038 </p>
2039 !! end
2041 TODO:
2042 more images
2043 more tables
2044 math
2045 character entities
2046 and much more