Fix #5918: links autonumbering now work for all defined protocols.
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 13 May 2006 19:29:24 +0000 (19:29 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 13 May 2006 19:29:24 +0000 (19:29 +0000)
RELEASE-NOTES
includes/Parser.php
maintenance/parserTests.txt

index 750e175..ddcf1f4 100644 (file)
@@ -257,6 +257,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 5833) Introduce CURRENTVERSION magic word
 * (bug 5370) Allow throttling of password reminder requests with the rate limiter
 * (bug 5683) Respect parser output marked as uncacheable when saving
+* (bug 5918) Links autonumbering now work for all defined protocols
 
 == Compatibility ==
 
index ec6f11e..9a84053 100644 (file)
@@ -1161,8 +1161,8 @@ class Parser
 
                        # No link text, e.g. [http://domain.tld/some.link]
                        if ( $text == '' ) {
-                               # Autonumber if allowed
-                               if ( strpos( HTTP_PROTOCOLS, str_replace('/','\/', $protocol) ) !== false ) {
+                               # Autonumber if allowed. See bug #5918
+                               if ( strpos( wfUrlProtocols(), substr($protocol, 0, strpos($protocol, ':')) ) !== false ) {
                                        $text = '[' . ++$this->mAutonumber . ']';
                                        $linktype = 'autonumber';
                                } else {
index cc1eeb6..259e755 100644 (file)
@@ -1045,7 +1045,7 @@ Table security: embedded pipes (http://mail.wikipedia.org/pipermail/wikitech-l/2
 !! result
 <table>
 <tr>
-<td><a href="ftp://|x||" class='external free' title="ftp://|x||" rel="nofollow">ftp://|x</td><td></a>" onmouseover="alert(document.cookie)">test
+<td><a href="ftp://|x||" class='external autonumber' title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
 </td>
 </tr>
 </table>
@@ -3949,6 +3949,27 @@ HTML nested ordered list, open tags (bug 5497)
 
 !! end
 
+!!test
+bug 5918: autonumbering
+!! input
+[http://first/] [http://second] [ftp://ftp]
+
+ftp://inlineftp
+
+[mailto:enclosed@mail.tld With target]
+
+[mailto:enclosed@mail.tld]
+
+mailto:inline@mail.tld
+!! result
+<p><a href="http://first/" class='external autonumber' title="http://first/" rel="nofollow">[1]</a> <a href="http://second" class='external autonumber' title="http://second" rel="nofollow">[2]</a> <a href="ftp://ftp" class='external autonumber' title="ftp://ftp" rel="nofollow">[3]</a>
+</p><p><a href="ftp://inlineftp" class='external free' title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
+</p><p><a href="mailto:enclosed@mail.tld" class='external text' title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
+</p><p><a href="mailto:enclosed@mail.tld" class='external autonumber' title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
+</p><p><a href="mailto:inline@mail.tld" class='external free' title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
+</p>
+!! end
+
 #
 #
 #