# MediaWiki Parser test cases
# see also http://meta.wikimedia.org/wiki/Parser_testing
-# At present these assume that $wgUseTidy is false and may break
-# if it is enabled.
-
!! test
Blank input
!! input
:and a colon
</nowiki>
!! result
-<p>Lorem ipsum dolor sed abit. sed nullum. :and a colon</p>
+<p>Lorem ipsum dolor
+
+sed abit.
+ sed nullum.
+
+:and a colon
+
+</p>
!! end
!! test
!! end
!! test
-!! disabled
comment test 2
!! input
asdf
<!-- comment 1 -->
jkl
!! result
-<p>asdf jkl
+<p>asdf
+jkl
</p>
!! end
!! test
comment test 3
-!! disabled
!! input
asdf
<!-- comment 1 -->
<!-- comment 2 -->
jkl
!! result
-<p>asdf jkl
+<p>asdf
+jkl
</p>
!! end
### External links
###
!! test
-External links 1-4
+External links: non-bracketed
!! input
Non-bracketed: http://example.com
+!! result
+<p>Non-bracketed: <a href="http://example.com" class='external'>http://example.com</a>
+</p>
+!! end
+!! test
+External links: numbered
+!! input
Numbered: [http://example.com]
+!! result
+<p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
+</p>
+!!end
+!! test
+External links: specified text
+!! input
Specified text: [http://example.com link]
+!! result
+<p>Specified text: <a href="http://example.com" class='external' title="http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
+</p>
+!!end
+!! test
+External links: trail
+!! input
Trail (not sure if this is meant to work): [http://example.com link]s
!! result
-<p>Non-bracketed: <a href="http://example.com" class='external' title="http://example.com">http://example.com</a>
-</p><p>Numbered: <a href="http://example.com" class='external' title="http://example.com">[1]</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
-</p><p>Specified text: <a href="http://example.com" class='external' title="http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
-</p><p>Trail (not sure if this is meant to work): <a href="http://example.com" class='external' title="http://example.com">link</a>s<span class='urlexpansion'> (<i>http://example.com</i>)</span>
+<p>Trail (not sure if this is meant to work): <a href="http://example.com" class='external' title="http://example.com">link</a>s<span class='urlexpansion'> (<i>http://example.com</i>)</span>
</p>
!! end
-# todo: enable these
!! test
-!! disabled
-External links
+External links: dollar sign in URL
+!! input
+http://example.com/1$2345
+!! result
+<p><a href="http://example.com/1$2345" class='external'>http://example.com/1$2345</a>
+</p>
+!! end
+
+!! test
+External links: dollar sign in URL (named)
+!! input
+[http://example.com/1$2345]
+!! result
+<p><a href="http://example.com/1$2345" class='external' title="http://example.com/1$2345">[1]</a><span class='urlexpansion'> (<i>http://example.com/1$2345</i>)</span>
+</p>
+!!end
+
+!! test
+External image
!! input
-Unrecognised characters (for no good reason): http://example.com/1$2345 [http://example.com/1$2345]
External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
+!! result
+<p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
+</p>
+!! end
+
+!! test
+External image from https
+!! input
External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
+!! result
+<p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" />
+</p>
+!! end
+
+!! test
+Link to non-http image, no img tag
+!! input
Link to non-http image, no img tag: ftp://example.com/test.jpg
+!! result
+<p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a>
+</p>
+!! end
+
+!! test
+External links: terminating separator
+!! input
Terminating separator: http://example.com/thing,
+!! result
+<p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,
+</p>
+!! end
+
+!! test
+External links: intervening separator
+!! input
Intervening separator: http://example.com/1,2,3
+!! result
+<p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a>
+</p>
+!! end
+
+!! test
+External links: old bug with URL in query
+!! input
Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
+!! result
+<p>Old bug with URL in query: <a href="http://example.com/thing?url=http://example.com" class='external' title="http://example.com/thing?url=http://example.com">link</a><span class='urlexpansion'> (<i>http://example.com/thing?url=http://example.com</i>)</span>
+</p>
+!! end
+
+!! test
+External links: old URL-in-URL bug, mixed protocols
+!! input
And again with mixed protocols: [ftp://example.com?url=http://example.com link]
+!! result
+<p>And again with mixed protocols: <a href="ftp://example.com?url=http://example.com" class='external' title="ftp://example.com?url=http://example.com">link</a><span class='urlexpansion'> (<i>ftp://example.com?url=http://example.com</i>)</span>
+</p>
+!!end
+
+!! test
+External links: URL in text
+!! input
URL in text: [http://example.com http://example.com]
+!! result
+<p>URL in text: <a href="http://example.com" class='external'>http://example.com</a>
+</p>
+!! end
+
+!! test
+External links: Clickable images
+!! input
ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
+!! result
+<p>ja-style clickable images: <a href="http://example.com" class='external' title="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a><span class='urlexpansion'> (<i>http://example.com</i>)</span>
+</p>
+!!end
+
+!! test
+External links: raw ampersand
+!! input
Old & use: http://x&y
-Escaping without &: http://x&y
!! result
-<p>Unrecognised characters (for no good reason): <a href="http://example.com/1" class='external'>http://example.com/1</a>$2345
-[http://example.com/1$2345]</p>
-<p>External image: <img src="http://example.com/test.jpg" alt="test.jpg" /></p>
-<p>External image from https: <img src="https://example.com/test.jpg" alt="test.jpg" /></p>
-<p>Link to non-http image, no img tag: <a href="ftp://example.com/test.jpg" class='external'>ftp://example.com/test.jpg</a></p>
-<p>Terminating separator: <a href="http://example.com/thing" class='external'>http://example.com/thing</a>,</p>
-<p>Intervening separator: <a href="http://example.com/1,2,3" class='external'>http://example.com/1,2,3</a></p>
-<p>Old bug with URL in query: [http://example.com/thing?url=<a href="http://example.com" class='external'>http://example.com</a>
-link]</p>
-<p>And again with mixed protocols: [ftp://example.com?url=<a href="http://example.com" class='external'>http://example.com</a>
-link]</p>
-<p>URL in text: <a href='http://example.com' class='external'></a><a href="http://example.com" class=
-'external'>http://example.com</a> <span class='urlexpansion'>(<i>http://example.com</i>)</span></p>
-<p>ja-style clickable images: <a href='http://example.com' class='external'><img src=
-"http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" /></a> <span class=
-'urlexpansion'>(<i>http://example.com</i>)</span></p>
-<p>Old & use: <a href="http://x&y" class='external'>http://x&y</a></p>
-<p>Escaping without &: <a href="http://x&y" class='external'>http://x&y</a></p>
+<p>Old & use: <a href="http://x&y" class='external'>http://x&y</a>
+</p>
+!! end
+
+!! test
+External links: www.jpeg.org (bug 554)
+!! input
+http://www.jpeg.org
+!!result
+<p><a href="http://www.jpeg.org" class='external'>http://www.jpeg.org</a>
+</p>
!! end
###
!! input
Normal text. '''Bold text.''' Normal text. ''Italic text.''
-'''Bold text..
-
-..spanning two paragraphs (should not work).'''
-
Normal text. '''''Bold italic text.''''' Normal text.
+!!result
+<p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
+</p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
+</p>
+!! end
+
+!! test
+Unclosed and unmatched quotes
+!! input
'''''Bold italic text '''with bold deactivated''' in between.'''''
'''''Bold italic text ''with italic deactivated'' in between.'''''
+'''Bold text..
+
+..spanning two paragraphs (should not work).'''
+
'''Bold tag left open
''Italic tag left open
''Tom'''s car is bigger than ''Susan'''s.
!! result
-<p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
+<p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
+</p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
</p><p><b>Bold text..</b>
-</p><p>..spanning two paragraphs (should not work).
-</p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
-</p><p><i><b>Bold italic text</b> with bold deactivated <b>in between.</b></i>
-</p><p><b><i>Bold italic text</i> with italic deactivated <i>in between.</i></b>
+</p><p>..spanning two paragraphs (should not work).<b></b>
</p><p><b>Bold tag left open</b>
</p><p><i>Italic tag left open</i>
</p><p>Normal text.
-</p><p><b>This year</b>'s election <i>should</i> beat <b>last year</b>'s.
-</p><p><i>Tom<b>s car is bigger than</b></i> <b>Susan</b>s.
+</p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
+</p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
</p>
!! end
Internal links
!! input
Plain link, capitalized: [[Main Page]]
-!! result
-<p>Plain link, capitalized: <a href="/wiki/Main_Page" title ="Main Page">Main Page</a>
-!! end
-!! test
-Internal links 2
-!! disabled
-!!input
Plain link, uncapitalized: [[main Page]]
Piped link: [[Main Page|The Main Page]]
Broken link: [[Zigzagzogzagzig]]
-Link with prefix: XXX[[main Page]], XXX[[Main Page]]
+Link with prefix: xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
-Link with suffix: [[Main Page]]XXX
+Link with suffix: [[Main Page]]xxx, [[Main Page]]XXX
Link with 3 brackets: [[[main page]]]
Link to image page: [[:Image:Ncwikicol.png]]
Plain link to URL: [[http://www.example.org]]
+!! result
+<p>Plain link, capitalized: <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
+</p><p>Plain link, uncapitalized: <a href="/wiki/Main_Page" title="Main Page">main Page</a>
+</p><p>Piped link: <a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
+</p><p>Broken link: <a href="/index.php?title=Zigzagzogzagzig&action=edit" class="new" title="Zigzagzogzagzig">Zigzagzogzagzig</a>
+</p><p>Link with prefix: 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>
+</p><p>Link with suffix: <a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX
+</p><p>Link with 3 brackets: [[[main page]]]
+</p><p>Piped link with 3 brackets: [[[main page|the main page]]]
+</p><p>Link to namespaces: <a href="/index.php?title=Talk:Parser_testing&action=edit" class="new" title="Talk:Parser testing">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">Meta:Disclaimers</a>
+</p><p>Piped link to namespace: <a href="/index.php?title=Meta:Disclaimers&action=edit" class="new" title="Meta:Disclaimers">The disclaimers</a>
+</p><p>Link to category: <a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
+</p><p>Link to image page: <a href="/wiki/Image:Ncwikicol.png" title="Image:Ncwikicol.png">Image:Ncwikicol.png</a>
+</p><p>Plain link to URL: [<a href="http://www.example.org" class='external' title="http://www.example.org">[1]</a><span class='urlexpansion'> (<i>http://www.example.org</i>)</span>]
+</p>
+!! test
+Piped link to URL
+!! input
Piped link to URL: [[http://www.example.org|an example URL]]
!! result
-</p><p>Plain link, uncapitalized: <a href="/wiki/Main_Page">main Page</a>
-</p><p>Piped link: <a href="/wiki/Main_Page">The Main Page</a></p>
-<p>Broken link: <a href="/w/wiki.phtml?title=Zigzagzogzagzig&action=edit" class="new">Zigzagzogzagzig</a></p>
-<p>Link with prefix: xxx<a href="/wiki/Main_Page">main Page</a>, xxx<a href="/wiki/Main_Page">Main Page</a>, Xxx<a href=
-"/wiki/Main_Page">main Page</a> XXX<a href="/wiki/Main_Page">main Page</a>, XXX<a href="/wiki/Main_Page">Main Page</a></p>
-<p>Link with suffix: <a href="/wiki/Main_Page">Main Pagexxx</a>, <a href="/wiki/Main_Page">Main Page</a>XXX</p>
-<p>Link with 3 brackets: [[[main page]]]</p>
-<p>Piped link with 3 brackets: [[[main page|the main page]]]</p>
-<p>Link to namespaces: <a href="/w/wiki.phtml?title=Talk:Parser_testing&action=edit" class="new">Talk:Parser testing</a>,
-<a href="/w/wiki.phtml?title=Meta:Disclaimers&action=edit" class="new">Meta:Disclaimers</a></p>
-<p>Piped link to namespace: <a href="/w/wiki.phtml?title=Meta:Disclaimers&action=edit" class="new">The disclaimers</a></p>
-<p>Link to category: <a href="/wiki/Category:MediaWiki_User%27s_Guide">Category:MediaWiki User's Guide</a></p>
-<p>Link to image page: <a href="/wiki/Image:Ncwikicol.png">Image:Ncwikicol.png</a></p>
-<p>Plain link to URL: [<a href='http://www.example.org' class='external'>[1]</a> <span class=
-'urlexpansion'>(<i>http://www.example.org</i>)</span>]</p>
-<p>Piped link to URL: <a href="/w/wiki.phtml?title=Http://www.example.org&action=edit" class="new">an example URL</a></p>
+<p>Piped link to URL: <a href="/index.php?title=http://www.example.org&action=edit" class="new">an example URL</a>
+</p>
!! end
+
+!! test
+BUG 2: [[page|http://url/]] should link to page, not http://url/
+!! input
+[[Main Page|http://url/]]
+!! result
+<p><a href="/wiki/Main_Page" title="Main Page">http://url</a>
+</p>
+!! end
+