Merge pull request #359 from freejosh/master

Allow other whitespace between @link tags and content
This commit is contained in:
Jeff Williams 2013-03-23 17:57:08 -07:00
commit d01442172f
2 changed files with 15 additions and 1 deletions

View File

@ -505,7 +505,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;

View File

@ -1106,6 +1106,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 <a href="path/to/test.html">test</a>.');
});
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 <a href="path/to/test.html">test</a>.');
});
// conf.monospaceLinks. check that
// a) it works
it('if conf.monospaceLinks is true, all {@link} should be monospace', function () {