diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-17 10:00:06 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-06-17 12:17:41 -1000 |
commit | 70f84d7207fb0c4a8cdf51ece48ec9f619a041f4 (patch) | |
tree | 6b79f9dbddb03d4ffffea2ae5c0f27245a5e77b5 /lib/render.js | |
parent | 7fe3cad4b29b4cac33766b12b9e49fbcf38bec25 (diff) | |
download | patchfoo-70f84d7207fb0c4a8cdf51ece48ec9f619a041f4.tar.gz patchfoo-70f84d7207fb0c4a8cdf51ece48ec9f619a041f4.zip |
Render npm-publish messages
Diffstat (limited to 'lib/render.js')
-rw-r--r-- | lib/render.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/render.js b/lib/render.js index fdff95c..2aef6b4 100644 --- a/lib/render.js +++ b/lib/render.js @@ -346,3 +346,19 @@ Render.prototype.getNameLink = function (id, cb) { cb(null, h('a', {href: self.toUrl(id)}, name)) }) } + +Render.prototype.npmAuthorLink = function (author) { + if (!author) return + var url = u.ifString(author.url) + var email = u.ifString(author.email) + var name = u.ifString(author.name) + if (!url && !email) return name || JSON.stringify(author) + if (!url && email) url = 'mailto:' + email, email = null + if (!name && email) name = email, email = null + if (!name && url) name = url + var secondaryLink = email && h('a', {href: this.toUrl('mailto:' + email)}, email) + return [ + h('a', {href: this.toUrl(url)}, name), + secondaryLink ? [' (', secondaryLink, ')'] : '' + ] +} |