don't try to parse HTML tags as type expressions (hegemonic/jsdoc-baseline#149)

This commit is contained in:
Jeff Williams 2015-03-15 17:12:14 -07:00
parent 951e9ef881
commit 0b41c89f83
2 changed files with 10 additions and 2 deletions

View File

@ -321,8 +321,9 @@ function buildLink(longname, linkText, options) {
text = linkText || stripped; text = linkText || stripped;
} }
// handle complex type expressions that may require multiple links // handle complex type expressions that may require multiple links
// (but skip anything that looks like an inline tag) // (but skip anything that looks like an inline tag or HTML tag)
else if (longname && isComplexTypeExpression(longname) && /\{\@.+\}/.test(longname) === false) { else if (longname && isComplexTypeExpression(longname) && /\{\@.+\}/.test(longname) === false &&
/^<[\s\S]+>/.test(longname) === false) {
parsedType = parseType(longname); parsedType = parseType(longname);
return stringifyType(parsedType, options.cssClass, options.linkMap); return stringifyType(parsedType, options.cssClass, options.linkMap);
} }

View File

@ -443,6 +443,13 @@ describe("jsdoc/util/templateHelper", function() {
expect(link).toBe('<a href="fakeclass.html#fragment">LinktoFakeClass</a>'); expect(link).toBe('<a href="fakeclass.html#fragment">LinktoFakeClass</a>');
}); });
it('returns the original text if an HTML <a> tag is specified', function() {
var text = '<a href="http://example.com">text</a>';
var link = helper.linkto(text);
expect(link).toBe(text);
});
it('returns the original text if an inline {@link} tag is specified', function() { it('returns the original text if an inline {@link} tag is specified', function() {
var link; var link;
var text = '{@link Foo}'; var text = '{@link Foo}';