From 6b7125b33e66c355a567c51deee690c345844adb Mon Sep 17 00:00:00 2001 From: Josh Freeman Date: Mon, 11 Mar 2013 11:03:12 -0300 Subject: [PATCH 1/2] Allow other whitespace between @link and content --- lib/jsdoc/util/templateHelper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jsdoc/util/templateHelper.js b/lib/jsdoc/util/templateHelper.js index 50d4dc2b..a46016cf 100644 --- a/lib/jsdoc/util/templateHelper.js +++ b/lib/jsdoc/util/templateHelper.js @@ -448,7 +448,7 @@ var toTutorial = exports.toTutorial = function(tutorial, content, missingOpts) { /** Find symbol {@link ...} and {@tutorial ...} strings in text and turn into html links */ exports.resolveLinks = function(str) { - str = str.replace(/(?:\[(.+?)\])?\{@link(plain|code)? +(.+?)\}/gi, + str = str.replace(/(?:\[(.+?)\])?\{@link(plain|code)?\s+(.+?)\}/gi, function(match, content, monospace, longname) { if (monospace === 'plain') { monospace = false; From f132ecc45a470909f07461018acac6531e703fcf Mon Sep 17 00:00:00 2001 From: Josh Freeman Date: Mon, 11 Mar 2013 10:26:07 -0400 Subject: [PATCH 2/2] tests for other whitespace in link tags --- test/specs/jsdoc/util/templateHelper.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/specs/jsdoc/util/templateHelper.js b/test/specs/jsdoc/util/templateHelper.js index 56b235c8..2d067099 100644 --- a/test/specs/jsdoc/util/templateHelper.js +++ b/test/specs/jsdoc/util/templateHelper.js @@ -1072,6 +1072,20 @@ describe("jsdoc/util/templateHelper", function() { expect(output).toBe('Link to constructor'); }); + it('should allow linebreaks between link tag and content', function() { + var input = 'This is a {@link\ntest}.', + output = helper.resolveLinks(input); + + expect(output).toBe('This is a test.'); + }); + + it('should allow tabs between link tag and content', function() { + var input = 'This is a {@link\ttest}.', + output = helper.resolveLinks(input); + + expect(output).toBe('This is a test.'); + }); + // conf.monospaceLinks. check that // a) it works it('if conf.monospaceLinks is true, all {@link} should be monospace', function () {