diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-09-20 12:25:08 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-09-22 10:59:45 -1000 |
commit | 9110e551179f40de7b323d7fd8cfcbd41bac8e8d (patch) | |
tree | c60a277723e32a61b2b8a51b4a9ab0f3ae44ed13 /lib | |
parent | 1e2dc6de6b0d0d59f61e42f99899fcfa2b0abcbe (diff) | |
download | patchfoo-9110e551179f40de7b323d7fd8cfcbd41bac8e8d.tar.gz patchfoo-9110e551179f40de7b323d7fd8cfcbd41bac8e8d.zip |
Make npm links more consistent
Diffstat (limited to 'lib')
-rw-r--r-- | lib/render.js | 12 | ||||
-rw-r--r-- | lib/serve.js | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/lib/render.js b/lib/render.js index 5a0ddaa..9a3ad42 100644 --- a/lib/render.js +++ b/lib/render.js @@ -423,10 +423,10 @@ Render.prototype.npmPackageMention = function (link, opts, cb) { var done = multicb({pluck: 1, spread: true}) var base = '/npm/' + (opts.author ? u.escapeId(link.author) + '/' : '') var pathWithAuthor = opts.withAuthor ? '/npm/' + - u.escapeId(link.author) + '/' + - (opts.name ? opts.name + '/' + - (opts.version ? opts.version + '/' + - (opts.distTag ? opts.distTag + '/' : '') : '') : '') : '' + u.escapeId(link.author) + + (opts.name ? '/' + opts.name + + (opts.version ? '/' + opts.version + + (opts.distTag ? '/' + opts.distTag + '/' : '') : '') : '') : '' self.app.getAbout(link.author, done()) self.app.getBlobState(link.link, done()) done(function (err, about, blobState) { @@ -441,11 +441,11 @@ Render.prototype.npmPackageMention = function (link, opts, cb) { title: 'package name' }, name), ' '), h('td', version ? [h('a', { - href: self.toUrl(base + name + '/' + version + '/'), + href: self.toUrl(base + name + '/' + version), title: 'package version' }, version), ' '] : ''), h('td', distTag ? [h('a', { - href: self.toUrl(base + name + '//' + distTag + '/'), + href: self.toUrl(base + name + '//' + distTag), title: 'dist-tag' }, distTag), ' '] : ''), h('td', {align: 'right'}, link.size != null ? [h('span', { diff --git a/lib/serve.js b/lib/serve.js index c162e42..30689eb 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -1890,10 +1890,10 @@ Serve.prototype.npm = function (url) { var render = self.app.render var base = '/npm/' + (author ? u.escapeId(author) + '/' : '') - var pathWithoutAuthor = '/npm/' + - (name ? name + '/' + - (version ? version + '/' + - (distTag ? distTag + '/' : '') : '') : '') + var pathWithoutAuthor = '/npm' + + (name ? '/' + name + + (version ? '/' + version + + (distTag ? '/' + distTag : '') : '') : '') return pull( ph('section', {}, [ ph('h3', [ph('a', {href: render.toUrl('/npm/')}, 'npm'), ' : ', @@ -1908,7 +1908,7 @@ Serve.prototype.npm = function (url) { ]), ph('table', [ ph('thead', ph('tr', [ - !author ? ph('td', 'publisher') : '', + ph('td', 'publisher'), ph('td', 'package'), ph('td', 'version'), ph('td', 'tag'), @@ -1926,7 +1926,7 @@ Serve.prototype.npm = function (url) { }), paramap(function (link, cb) { self.app.render.npmPackageMention(link, { - withAuthor: !author, + withAuthor: true, author: author, name: name, version: version, |