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 705202d

Browse filesBrowse files
sarahmeyerMylesBorins
authored andcommitted
tools: use template literals
PR-URL: #15956 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent f954536 commit 705202d
Copy full SHA for 705202d

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

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

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const DOC_CREATED_REG_EXP = /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.([0
1515
// customized heading without id attribute
1616
var renderer = new marked.Renderer();
1717
renderer.heading = function(text, level) {
18-
return '<h' + level + '>' + text + '</h' + level + '>\n';
18+
return `<h${level}>${text}</h${level}>\n`;
1919
};
2020
marked.setOptions({
2121
renderer: renderer
@@ -85,7 +85,7 @@ function loadGtoc(cb) {
8585
if (err) return cb(err);
8686

8787
data = marked(data).replace(/<a href="(.*?)"/gm, function(a, m) {
88-
return '<a class="nav-' + toID(m) + '" href="' + m + '"';
88+
return `<a class="nav-${toID(m)}" href="${m}"`;
8989
});
9090
return cb(null, data);
9191
});
@@ -130,7 +130,7 @@ function render(opts, cb) {
130130
template = template.replace(/__TOC__/g, toc);
131131
template = template.replace(
132132
/__GTOC__/g,
133-
gtocData.replace('class="nav-' + id, 'class="nav-' + id + ' active')
133+
gtocData.replace(`class="nav-${id}`, `class="nav-${id} active`)
134134
);
135135

136136
if (opts.analytics) {
@@ -448,8 +448,8 @@ function buildToc(lexed, filename, cb) {
448448
const realFilename = path.basename(realFilenames[0], '.md');
449449
const id = getId(realFilename + '_' + tok.text.trim());
450450
toc.push(new Array((depth - 1) * 2 + 1).join(' ') +
451-
'* <span class="stability_' + tok.stability + '">' +
452-
'<a href="#' + id + '">' + tok.text + '</a></span>');
451+
`* <span class="stability_${tok.stability}">` +
452+
`<a href="#${id}">${tok.text}</a></span>`);
453453
tok.text += '<span><a class="mark" href="#' + id + '" ' +
454454
'id="' + id + '">#</a></span>';
455455
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.