Skip to content

Commit 422d315

Browse files
Patrick Heneisecjihrig
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 <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent bcd818a commit 422d315

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
@@ -499,12 +499,12 @@ function buildToc(lexed, filename, cb) {
499499

500500
depth = tok.depth;
501501
const realFilename = path.basename(realFilenames[0], '.md');
502-
const id = getId(realFilename + '_' + tok.text.trim());
502+
const id = getId(`${realFilename}_${tok.text.trim()}`);
503503
toc.push(new Array((depth - 1) * 2 + 1).join(' ') +
504504
`* <span class="stability_${tok.stability}">` +
505505
`<a href="#${id}">${tok.text}</a></span>`);
506-
tok.text += '<span><a class="mark" href="#' + id + '" ' +
507-
'id="' + id + '">#</a></span>';
506+
tok.text += `<span><a class="mark" href="#${id}"` +
507+
`id="${id}">#</a></span>`;
508508
});
509509

510510
toc = marked.parse(toc.join('\n'));
@@ -518,7 +518,7 @@ function getId(text) {
518518
text = text.replace(/^_+|_+$/, '');
519519
text = text.replace(/^([^a-z])/, '_$1');
520520
if (idCounters.hasOwnProperty(text)) {
521-
text += '_' + (++idCounters[text]);
521+
text += `_${(++idCounters[text])}`;
522522
} else {
523523
idCounters[text] = 0;
524524
}

0 commit comments

Comments
 (0)