mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
turn '@author' tag text into mailto: link where possible (#326)
This commit is contained in:
parent
337bd90275
commit
434c80e803
@ -448,6 +448,11 @@ exports.resolveLinks = function(str) {
|
||||
return str;
|
||||
};
|
||||
|
||||
/** Convert tag text like "Jane Doe <jdoe@example.org>" into a mailto link */
|
||||
exports.resolveAuthorLinks = function(str) {
|
||||
return str.replace(/^\s?([\s\S]+)\b\s+<(\S+@\S+)>\s?$/, '<a href="mailto:$2">$1</a>');
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a longname's filename if one has been registered; otherwise, generate a unique filename, then
|
||||
* register the filename.
|
||||
|
||||
@ -7,6 +7,7 @@ var template = require('jsdoc/template'),
|
||||
helper = require('jsdoc/util/templateHelper'),
|
||||
htmlsafe = helper.htmlsafe,
|
||||
linkto = helper.linkto,
|
||||
resolveAuthorLinks = helper.resolveAuthorLinks,
|
||||
scopeToPunc = helper.scopeToPunc,
|
||||
hasOwnProp = Object.prototype.hasOwnProperty,
|
||||
data,
|
||||
@ -415,6 +416,7 @@ exports.publish = function(taffyData, opts, tutorials) {
|
||||
// add template helpers
|
||||
view.find = find;
|
||||
view.linkto = linkto;
|
||||
view.resolveAuthorLinks = resolveAuthorLinks;
|
||||
view.tutoriallink = tutoriallink;
|
||||
view.htmlsafe = htmlsafe;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ var self = this;
|
||||
<dt class="tag-author">Author:</dt>
|
||||
<dd class="tag-author">
|
||||
<ul><?js author.forEach(function(a) { ?>
|
||||
<li><?js= a ?></li>
|
||||
<li><?js= self.resolveAuthorLinks(a) ?></li>
|
||||
<?js }); ?></ul>
|
||||
</dd>
|
||||
<?js } ?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user