From 0b41c89f83d1cf8a58c480c072d4fc61aa7e3807 Mon Sep 17 00:00:00 2001 From: Jeff Williams Date: Sun, 15 Mar 2015 17:12:14 -0700 Subject: [PATCH] don't try to parse HTML tags as type expressions (hegemonic/jsdoc-baseline#149) --- lib/jsdoc/util/templateHelper.js | 5 +++-- test/specs/jsdoc/util/templateHelper.js | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/jsdoc/util/templateHelper.js b/lib/jsdoc/util/templateHelper.js index 13ca389a..b74581a0 100644 --- a/lib/jsdoc/util/templateHelper.js +++ b/lib/jsdoc/util/templateHelper.js @@ -321,8 +321,9 @@ function buildLink(longname, linkText, options) { text = linkText || stripped; } // handle complex type expressions that may require multiple links - // (but skip anything that looks like an inline tag) - else if (longname && isComplexTypeExpression(longname) && /\{\@.+\}/.test(longname) === false) { + // (but skip anything that looks like an inline tag or HTML tag) + else if (longname && isComplexTypeExpression(longname) && /\{\@.+\}/.test(longname) === false && + /^<[\s\S]+>/.test(longname) === false) { parsedType = parseType(longname); return stringifyType(parsedType, options.cssClass, options.linkMap); } diff --git a/test/specs/jsdoc/util/templateHelper.js b/test/specs/jsdoc/util/templateHelper.js index 040bb792..c2cd1207 100644 --- a/test/specs/jsdoc/util/templateHelper.js +++ b/test/specs/jsdoc/util/templateHelper.js @@ -443,6 +443,13 @@ describe("jsdoc/util/templateHelper", function() { expect(link).toBe('LinktoFakeClass'); }); + it('returns the original text if an HTML tag is specified', function() { + var text = 'text'; + var link = helper.linkto(text); + + expect(link).toBe(text); + }); + it('returns the original text if an inline {@link} tag is specified', function() { var link; var text = '{@link Foo}';