Skip to content

Commit d165d3f

Browse files
Patrick HeneiseMylesBorins
Patrick Heneise
authored andcommitted
tools: replace string concetation with templates
Replace string concatenation in tools/doc/html.js with template literals. PR-URL: #16801 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 755f5e3 commit d165d3f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/doc/html.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,12 @@ function buildToc(lexed, filename, cb) {
447447

448448
depth = tok.depth;
449449
const realFilename = path.basename(realFilenames[0], '.md');
450-
const id = getId(realFilename + '_' + tok.text.trim());
450+
const id = getId(`${realFilename}_${tok.text.trim()}`);
451451
toc.push(new Array((depth - 1) * 2 + 1).join(' ') +
452452
`* <span class="stability_${tok.stability}">` +
453453
`<a href="#${id}">${tok.text}</a></span>`);
454-
tok.text += '<span><a class="mark" href="#' + id + '" ' +
455-
'id="' + id + '">#</a></span>';
454+
tok.text += `<span><a class="mark" href="#${id}"` +
455+
`id="${id}">#</a></span>`;
456456
});
457457

458458
toc = marked.parse(toc.join('\n'));
@@ -466,7 +466,7 @@ function getId(text) {
466466
text = text.replace(/^_+|_+$/, '');
467467
text = text.replace(/^([^a-z])/, '_$1');
468468
if (idCounters.hasOwnProperty(text)) {
469-
text += '_' + (++idCounters[text]);
469+
text += `_${(++idCounters[text])}`;
470470
} else {
471471
idCounters[text] = 0;
472472
}

0 commit comments

Comments
 (0)