From 3df288bcd2a6a7d74b79d4e3ff25a46243b418ad Mon Sep 17 00:00:00 2001 From: Rotorz Limited Date: Tue, 30 Aug 2011 21:50:27 +0200 Subject: [PATCH] Replaced toLink function with one that recognises {@link url text} or {@link url} tags. Previous implementation didn't appear to resolve links --- rhino_modules/jsdoc/util/templateHelper.js | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/rhino_modules/jsdoc/util/templateHelper.js b/rhino_modules/jsdoc/util/templateHelper.js index ced87b8c..532db2aa 100644 --- a/rhino_modules/jsdoc/util/templateHelper.js +++ b/rhino_modules/jsdoc/util/templateHelper.js @@ -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;