mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge pull request #359 from freejosh/master
Allow other whitespace between @link tags and content
This commit is contained in:
commit
d01442172f
@ -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 */
|
/** Find symbol {@link ...} and {@tutorial ...} strings in text and turn into html links */
|
||||||
exports.resolveLinks = function(str) {
|
exports.resolveLinks = function(str) {
|
||||||
str = str.replace(/(?:\[(.+?)\])?\{@link(plain|code)? +(.+?)\}/gi,
|
str = str.replace(/(?:\[(.+?)\])?\{@link(plain|code)?\s+(.+?)\}/gi,
|
||||||
function(match, content, monospace, longname) {
|
function(match, content, monospace, longname) {
|
||||||
if (monospace === 'plain') {
|
if (monospace === 'plain') {
|
||||||
monospace = false;
|
monospace = false;
|
||||||
|
|||||||
@ -1106,6 +1106,20 @@ describe("jsdoc/util/templateHelper", function() {
|
|||||||
expect(output).toBe('Link to constructor');
|
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
|
// conf.monospaceLinks. check that
|
||||||
// a) it works
|
// a) it works
|
||||||
it('if conf.monospaceLinks is true, all {@link} should be monospace', function () {
|
it('if conf.monospaceLinks is true, all {@link} should be monospace', function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user