Skip to content

Commit

Permalink
Remove 'v' from displayed Node.js versions (#1387)
Browse files Browse the repository at this point in the history
* Handlebars: Strip leading 'v' from Node.js version

Other components like npm, v8, etc. don't have this prefix.

* Just some sorting and arrow functions
  • Loading branch information
fhemberger authored Oct 6, 2017
1 parent 145c7f3 commit 2560114
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
27 changes: 12 additions & 15 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,26 +163,23 @@ function buildLocale (source, locale) {
pattern: '**/*.html',
partials: 'layouts/partials',
helpers: {
apidocslink: require('./scripts/helpers/apidocslink.js'),
changeloglink: require('./scripts/helpers/changeloglink.js'),
copyright: require('./scripts/helpers/copyright-year.js'),
equals: require('./scripts/helpers/equals.js'),
majorapidocslink: require('./scripts/helpers/majorapidocslink.js'),
startswith: require('./scripts/helpers/startswith.js'),
changeloglink: require('./scripts/helpers/changeloglink.js'),
strftime: require('./scripts/helpers/strftime.js'),
apidocslink: require('./scripts/helpers/apidocslink.js'),
majorapidocslink: require('./scripts/helpers/majorapidocslink.js'),
stripv: require('./scripts/helpers/stripv.js'),
summary: require('./scripts/helpers/summary.js'),
json: function (context) {
return JSON.stringify(context)
},
getListJson: function (context) {
var result = context.map(function (item) {
return {
title: item.title,
date: item.date,
local: true,
path: item.path.replace(/\\/, '/')
}
})
json: (context) => JSON.stringify(context),
getListJson: (context) => {
const result = context.map(item => ({
title: item.title,
date: item.date,
local: true,
path: item.path.replace(/\\/, '/')
}))
return JSON.stringify(result)
}
}
Expand Down
2 changes: 1 addition & 1 deletion layouts/download-releases.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<tbody>
{{#each project.versions}}
<tr>
<td data-label="Version">{{name}} {{version}}</td>
<td data-label="Version">{{name}} {{stripv version}}</td>
<td data-label="LTS">{{#if lts}}{{lts}}{{/if}}</td>
<td data-label="Date"><time>{{date}}</time></td>
<td data-label="V8">{{v8}}</td>
Expand Down
8 changes: 4 additions & 4 deletions layouts/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

<div class="home-downloadblock">

<a href="https://nodejs.org/dist/{{ project.latestVersions.lts.node }}/" class="home-downloadbutton" title="{{ labels.download }} {{ project.latestVersions.lts.node }} {{ labels.lts }}" data-version="{{ project.latestVersions.lts.node }}">
{{ project.latestVersions.lts.node }} {{ labels.lts }}
<a href="https://nodejs.org/dist/{{ project.latestVersions.lts.node }}/" class="home-downloadbutton" title="{{ labels.download }} {{stripv project.latestVersions.lts.node }} {{ labels.lts }}" data-version="{{ project.latestVersions.lts.node }}">
{{stripv project.latestVersions.lts.node }} {{ labels.lts }}
<small>{{ labels.tagline-lts }}</small>
</a>

Expand All @@ -53,8 +53,8 @@
{{#if project.latestVersions.current.node}}
<div class="home-downloadblock">

<a href="https://nodejs.org/dist/{{ project.latestVersions.current.node }}/" class="home-downloadbutton" title="{{ labels.download }} {{ project.latestVersions.current.node }} {{ labels.current }}" data-version="{{ project.latestVersions.current.node }}">
{{ project.latestVersions.current.node }} {{ labels.current }}
<a href="https://nodejs.org/dist/{{ project.latestVersions.current.node }}/" class="home-downloadbutton" title="{{ labels.download }} {{stripv project.latestVersions.current.node }} {{ labels.current }}" data-version="{{ project.latestVersions.current.node }}">
{{stripv project.latestVersions.current.node }} {{ labels.current }}
<small>{{ labels.tagline-current }}</small>
</a>

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/primary-download-matrix.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<section>
<p class="color-lightgray">{{downloads.currentVersion}}: <strong>{{version.node}}</strong> (includes npm {{version.npm}})</p>
<p class="color-lightgray">{{downloads.currentVersion}}: <strong>{{stripv version.node}}</strong> (includes npm {{version.npm}})</p>
<p>{{downloads.intro}}</p>
<div class="download-hero full-width">
<ul class="no-padding download-version-toggle">
Expand Down
3 changes: 3 additions & 0 deletions scripts/helpers/stripv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict'

module.exports = (version) => version.replace(/^v/, '')

0 comments on commit 2560114

Please sign in to comment.