Merge pull request #25 from rotorz/master

{@link url} elements were not being transformed into clickable links
This commit is contained in:
Michael Mathews 2011-08-30 14:06:42 -07:00
commit 8ee5fff8d1

View File

@ -66,9 +66,24 @@ function toLink(longname, content) {
if (!longname) {
throw new Error('Missing required parameter: url');
}
content = content || longname;
var url = linkMap.longnameToUrl[longname];
// Has link been specified manually?
var url;
if (/^(http|ftp)s?:/.test(longname)) {
url = longname;
// Has link text been specified {@link http://github.com GitHub Website}
var split = url.indexOf(' ');
if (split !== -1) {
content = url.substr(split + 1);
url = url.substr(0, split);
}
}
else {
url = linkMap.longnameToUrl[longname];
}
content = content || longname;
if (!url) {
return content;