Skip to content

Commit d454add

Browse files
BridgeARaddaleax
authored andcommitted
tools: change var to const in ./doc/html
PR-URL: #13732 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 8edde98 commit d454add

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

tools/doc/html.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module.exports = toHTML;
3333
const STABILITY_TEXT_REG_EXP = /(.*:)\s*(\d)([\s\S]*)/;
3434

3535
// customized heading without id attribute
36-
var renderer = new marked.Renderer();
36+
const renderer = new marked.Renderer();
3737
renderer.heading = function(text, level) {
3838
return '<h' + level + '>' + text + '</h' + level + '>\n';
3939
};
@@ -42,7 +42,7 @@ marked.setOptions({
4242
});
4343

4444
// TODO(chrisdickinson): never stop vomitting / fix this.
45-
var gtocPath = path.resolve(path.join(
45+
const gtocPath = path.resolve(path.join(
4646
__dirname,
4747
'..',
4848
'..',
@@ -57,8 +57,8 @@ var gtocData = null;
5757
* opts: input, filename, template, nodeVersion.
5858
*/
5959
function toHTML(opts, cb) {
60-
var template = opts.template;
61-
var nodeVersion = opts.nodeVersion || process.version;
60+
const template = opts.template;
61+
const nodeVersion = opts.nodeVersion || process.version;
6262

6363
if (gtocData) {
6464
return onGtocLoaded();
@@ -80,7 +80,7 @@ function toHTML(opts, cb) {
8080
}
8181

8282
function onGtocLoaded() {
83-
var lexed = marked.lexer(opts.input);
83+
const lexed = marked.lexer(opts.input);
8484
fs.readFile(template, 'utf8', function(er, template) {
8585
if (er) return cb(er);
8686
render({
@@ -123,10 +123,10 @@ function render(opts, cb) {
123123
var lexed = opts.lexed;
124124
var filename = opts.filename;
125125
var template = opts.template;
126-
var nodeVersion = opts.nodeVersion || process.version;
126+
const nodeVersion = opts.nodeVersion || process.version;
127127

128128
// get the section
129-
var section = getSection(lexed);
129+
const section = getSection(lexed);
130130

131131
filename = path.basename(filename, '.md');
132132

@@ -138,7 +138,7 @@ function render(opts, cb) {
138138
buildToc(lexed, filename, function(er, toc) {
139139
if (er) return cb(er);
140140

141-
var id = toID(path.basename(filename));
141+
const id = toID(path.basename(filename));
142142

143143
template = template.replace(/__ID__/g, id);
144144
template = template.replace(/__FILENAME__/g, filename);
@@ -220,9 +220,9 @@ function parseText(lexed) {
220220
// lists that come right after a heading are what we're after.
221221
function parseLists(input) {
222222
var state = null;
223-
var savedState = [];
223+
const savedState = [];
224224
var depth = 0;
225-
var output = [];
225+
const output = [];
226226
let headingIndex = -1;
227227
let heading = null;
228228

@@ -353,7 +353,7 @@ function parseYAML(text) {
353353
}
354354

355355
// Syscalls which appear in the docs, but which only exist in BSD / OSX
356-
var BSD_ONLY_SYSCALLS = new Set(['lchmod']);
356+
const BSD_ONLY_SYSCALLS = new Set(['lchmod']);
357357

358358
// Handle references to man pages, eg "open(2)" or "lchmod(2)"
359359
// Returns modified text, with such refs replace with HTML links, for example
@@ -363,7 +363,7 @@ function linkManPages(text) {
363363
/ ([a-z.]+)\((\d)([a-z]?)\)/gm,
364364
(match, name, number, optionalCharacter) => {
365365
// name consists of lowercase letters, number is a single digit
366-
var displayAs = `${name}(${number}${optionalCharacter})`;
366+
const displayAs = `${name}(${number}${optionalCharacter})`;
367367
if (BSD_ONLY_SYSCALLS.has(name)) {
368368
return ` <a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` +
369369
`&sektion=${number}">${displayAs}</a>`;
@@ -375,7 +375,7 @@ function linkManPages(text) {
375375
}
376376

377377
function linkJsTypeDocs(text) {
378-
var parts = text.split('`');
378+
const parts = text.split('`');
379379
var i;
380380
var typeMatches;
381381

@@ -453,7 +453,7 @@ function buildToc(lexed, filename, cb) {
453453
cb(null, toc);
454454
}
455455

456-
var idCounters = {};
456+
const idCounters = {};
457457
function getId(text) {
458458
text = text.toLowerCase();
459459
text = text.replace(/[^a-z0-9]+/g, '_');

0 commit comments

Comments
 (0)