summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-06-19 17:55:10 +0200
committerRefael Ackermann <refack@gmail.com>2017-07-02 19:26:41 -0400
commit0808989d938b53035fb858b0e21e2984e991e7a0 (patch)
tree7fe8321d62de81d329be6aecfb1266288469a4a6 /tools
parentbce27c2cf37ed96abecd7625ff1d22c72c3b99c8 (diff)
downloadandroid-node-v8-0808989d938b53035fb858b0e21e2984e991e7a0.tar.gz
android-node-v8-0808989d938b53035fb858b0e21e2984e991e7a0.tar.bz2
android-node-v8-0808989d938b53035fb858b0e21e2984e991e7a0.zip
tools: change var to const in ./doc/html
PR-URL: https://github.com/nodejs/node/pull/13732 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/html.js28
1 files changed, 14 insertions, 14 deletions
diff --git a/tools/doc/html.js b/tools/doc/html.js
index 8a071b2e46..a48b04b379 100644
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -33,7 +33,7 @@ module.exports = toHTML;
const STABILITY_TEXT_REG_EXP = /(.*:)\s*(\d)([\s\S]*)/;
// customized heading without id attribute
-var renderer = new marked.Renderer();
+const renderer = new marked.Renderer();
renderer.heading = function(text, level) {
return '<h' + level + '>' + text + '</h' + level + '>\n';
};
@@ -42,7 +42,7 @@ marked.setOptions({
});
// TODO(chrisdickinson): never stop vomitting / fix this.
-var gtocPath = path.resolve(path.join(
+const gtocPath = path.resolve(path.join(
__dirname,
'..',
'..',
@@ -57,8 +57,8 @@ var gtocData = null;
* opts: input, filename, template, nodeVersion.
*/
function toHTML(opts, cb) {
- var template = opts.template;
- var nodeVersion = opts.nodeVersion || process.version;
+ const template = opts.template;
+ const nodeVersion = opts.nodeVersion || process.version;
if (gtocData) {
return onGtocLoaded();
@@ -80,7 +80,7 @@ function toHTML(opts, cb) {
}
function onGtocLoaded() {
- var lexed = marked.lexer(opts.input);
+ const lexed = marked.lexer(opts.input);
fs.readFile(template, 'utf8', function(er, template) {
if (er) return cb(er);
render({
@@ -123,10 +123,10 @@ function render(opts, cb) {
var lexed = opts.lexed;
var filename = opts.filename;
var template = opts.template;
- var nodeVersion = opts.nodeVersion || process.version;
+ const nodeVersion = opts.nodeVersion || process.version;
// get the section
- var section = getSection(lexed);
+ const section = getSection(lexed);
filename = path.basename(filename, '.md');
@@ -138,7 +138,7 @@ function render(opts, cb) {
buildToc(lexed, filename, function(er, toc) {
if (er) return cb(er);
- var id = toID(path.basename(filename));
+ const id = toID(path.basename(filename));
template = template.replace(/__ID__/g, id);
template = template.replace(/__FILENAME__/g, filename);
@@ -220,9 +220,9 @@ function parseText(lexed) {
// lists that come right after a heading are what we're after.
function parseLists(input) {
var state = null;
- var savedState = [];
+ const savedState = [];
var depth = 0;
- var output = [];
+ const output = [];
let headingIndex = -1;
let heading = null;
@@ -353,7 +353,7 @@ function parseYAML(text) {
}
// Syscalls which appear in the docs, but which only exist in BSD / OSX
-var BSD_ONLY_SYSCALLS = new Set(['lchmod']);
+const BSD_ONLY_SYSCALLS = new Set(['lchmod']);
// Handle references to man pages, eg "open(2)" or "lchmod(2)"
// Returns modified text, with such refs replace with HTML links, for example
@@ -363,7 +363,7 @@ function linkManPages(text) {
/ ([a-z.]+)\((\d)([a-z]?)\)/gm,
(match, name, number, optionalCharacter) => {
// name consists of lowercase letters, number is a single digit
- var displayAs = `${name}(${number}${optionalCharacter})`;
+ const displayAs = `${name}(${number}${optionalCharacter})`;
if (BSD_ONLY_SYSCALLS.has(name)) {
return ` <a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
`&sektion=${number}">${displayAs}</a>`;
@@ -375,7 +375,7 @@ function linkManPages(text) {
}
function linkJsTypeDocs(text) {
- var parts = text.split('`');
+ const parts = text.split('`');
var i;
var typeMatches;
@@ -453,7 +453,7 @@ function buildToc(lexed, filename, cb) {
cb(null, toc);
}
-var idCounters = {};
+const idCounters = {};
function getId(text) {
text = text.toLowerCase();
text = text.replace(/[^a-z0-9]+/g, '_');