turn '@author' tag text into mailto: link where possible (#326)

This commit is contained in:
Jeff Williams 2013-01-28 07:33:07 -08:00
parent 337bd90275
commit 434c80e803
3 changed files with 8 additions and 1 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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 } ?>