Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 40fa970

Browse filesBrowse files
Patrick HeneiseMylesBorins
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 7b14917 commit 40fa970
Copy full SHA for 40fa970

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+4-4Lines changed: 4 additions & 4 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.