cecco974 / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Allow user to specify link text #174

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
{@link name [text]}

Original issue reported on code.google.com by micmath on 13 Aug 2008 at 12:53

GoogleCodeExporter commented 8 years ago
I hacked the following up for use at work today:

/** Find symbol {@link ...} strings in text and turn into html links */
function resolveLinks(str, from) {
   str = str.replace(/\{@link ([^}]+)\}/gi,
      function(match, symbolName) {
         symbolName = symbolName.trim();
         var index = symbolName.indexOf(' ');
         if (index > 0) {
            var label = symbolName.substring(index + 1);
            symbolName = symbolName.substring(0, index);
            return new Link().toSymbol(symbolName).withText(label);
         } else {
            return new Link().toSymbol(symbolName);
         }
      }
   );

   return str;
}

Original comment by ryan.gus...@gmail.com on 18 Dec 2009 at 11:15

GoogleCodeExporter commented 8 years ago
Add in the following to support the JavaDoc inline {@code code} tag:

   str = str.replace(/\{@code ([^}]+)\}/gi,
      function(match, code) {
         return '<code>' + code + '</code>';
      }
   );

Original comment by ryan.gus...@gmail.com on 23 Dec 2009 at 7:21