| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 01e3190 commit 140611b
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -47,7 +47,7 @@ function once(fn) { | |||
| 47 | 47 | } | |
| 48 | 48 | ||
| 49 | 49 | function verifyFiles(files, blockName, onprogress, ondone) { | |
| 50 | - // must have a .cc and a .js to be a valid test | ||
| 50 | + // Must have a .cc and a .js to be a valid test. | ||
| 51 | 51 | if (!Object.keys(files).some((name) => /\.cc$/.test(name)) || | |
| 52 | 52 | !Object.keys(files).some((name) => /\.js$/.test(name))) { | |
| 53 | 53 | return; | |
@@ -95,7 +95,7 @@ ${files[name].replace( | |||
| 95 | 95 | }); | |
| 96 | 96 | ||
| 97 | 97 | fs.mkdir(dir, function() { | |
| 98 | - // Ignore errors | ||
| 98 | + // Ignore errors. | ||
| 99 | 99 | ||
| 100 | 100 | const done = once(ondone); | |
| 101 | 101 | var waiting = files.length; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ function extractAndParseYAML(text) { | |||
| 15 | 15 | .replace(/^<!-- YAML/, '') | |
| 16 | 16 | .replace(/-->$/, ''); | |
| 17 | 17 | ||
| 18 | - // js-yaml.safeLoad() throws on error | ||
| 18 | + // js-yaml.safeLoad() throws on error. | ||
| 19 | 19 | const meta = yaml.safeLoad(text); | |
| 20 | 20 | ||
| 21 | 21 | if (meta.added) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,8 +24,8 @@ | |||
| 24 | 24 | const processIncludes = require('./preprocess.js'); | |
| 25 | 25 | const fs = require('fs'); | |
| 26 | 26 | ||
| 27 | - // parse the args. | ||
| 28 | - // Don't use nopt or whatever for this. It's simple enough. | ||
| 27 | + // Parse the args. | ||
| 28 | + // Don't use nopt or whatever for this. It's simple enough. | ||
| 29 | 29 | ||
| 30 | 30 | const args = process.argv.slice(2); | |
| 31 | 31 | let format = 'json'; | |
@@ -56,7 +56,7 @@ if (!filename) { | |||
| 56 | 56 | ||
| 57 | 57 | fs.readFile(filename, 'utf8', (er, input) => { | |
| 58 | 58 | if (er) throw er; | |
| 59 | - // process the input for @include lines | ||
| 59 | + // Process the input for @include lines. | ||
| 60 | 60 | processIncludes(filename, input, next); | |
| 61 | 61 | }); | |
| 62 | 62 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,7 +33,7 @@ module.exports = toHTML; | |||
| 33 | 33 | const STABILITY_TEXT_REG_EXP = /(.*:)\s*(\d)([\s\S]*)/; | |
| 34 | 34 | const DOC_CREATED_REG_EXP = /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.([0-9]+)\s*-->/; | |
| 35 | 35 | ||
| 36 | - // customized heading without id attribute | ||
| 36 | + // Customized heading without id attribute. | ||
| 37 | 37 | const renderer = new marked.Renderer(); | |
| 38 | 38 | renderer.heading = function(text, level) { | |
| 39 | 39 | return `<h${level}>${text}</h${level}>\n`; | |
@@ -42,7 +42,7 @@ marked.setOptions({ | |||
| 42 | 42 | renderer: renderer | |
| 43 | 43 | }); | |
| 44 | 44 | ||
| 45 | - // TODO(chrisdickinson): never stop vomitting / fix this. | ||
| 45 | + // TODO(chrisdickinson): never stop vomiting / fix this. | ||
| 46 | 46 | const gtocPath = path.resolve(path.join( | |
| 47 | 47 | __dirname, | |
| 48 | 48 | '..', | |
@@ -128,16 +128,16 @@ function render(opts, cb) { | |||
| 128 | 128 | var { lexed, filename, template } = opts; | |
| 129 | 129 | const nodeVersion = opts.nodeVersion || process.version; | |
| 130 | 130 | ||
| 131 | - // get the section | ||
| 131 | + // Get the section. | ||
| 132 | 132 | const section = getSection(lexed); | |
| 133 | 133 | ||
| 134 | 134 | filename = path.basename(filename, '.md'); | |
| 135 | 135 | ||
| 136 | 136 | parseText(lexed); | |
| 137 | 137 | lexed = parseLists(lexed); | |
| 138 | 138 | ||
| 139 | - // generate the table of contents. | ||
| 140 | - // this mutates the lexed contents in-place. | ||
| 139 | + // Generate the table of contents. | ||
| 140 | + // This mutates the lexed contents in-place. | ||
| 141 | 141 | buildToc(lexed, filename, function(er, toc) { | |
| 142 | 142 | if (er) return cb(er); | |
| 143 | 143 | ||
@@ -162,8 +162,8 @@ function render(opts, cb) { | |||
| 162 | 162 | ||
| 163 | 163 | template = template.replace(/__ALTDOCS__/, altDocs(filename)); | |
| 164 | 164 | ||
| 165 | - // content has to be the last thing we do with | ||
| 166 | - // the lexed tokens, because it's destructive. | ||
| 165 | + // Content has to be the last thing we do with the lexed tokens, | ||
| 166 | + // because it's destructive. | ||
| 167 | 167 | const content = marked.parser(lexed); | |
| 168 | 168 | template = template.replace(/__CONTENT__/g, content); | |
| 169 | 169 | ||
@@ -188,7 +188,7 @@ function analyticsScript(analytics) { | |||
| 188 | 188 | `; | |
| 189 | 189 | } | |
| 190 | 190 | ||
| 191 | - // replace placeholders in text tokens | ||
| 191 | + // Replace placeholders in text tokens. | ||
| 192 | 192 | function replaceInText(text) { | |
| 193 | 193 | return linkJsTypeDocs(linkManPages(text)); | |
| 194 | 194 | } | |
@@ -244,8 +244,8 @@ function altDocs(filename) { | |||
| 244 | 244 | `; | |
| 245 | 245 | } | |
| 246 | 246 | ||
| 247 | - // handle general body-text replacements | ||
| 248 | - // for example, link man page references to the actual page | ||
| 247 | + // Handle general body-text replacements. | ||
| 248 | + // For example, link man page references to the actual page. | ||
| 249 | 249 | function parseText(lexed) { | |
| 250 | 250 | lexed.forEach(function(tok) { | |
| 251 | 251 | if (tok.type === 'table') { | |
@@ -272,8 +272,8 @@ function parseText(lexed) { | |||
| 272 | 272 | }); | |
| 273 | 273 | } | |
| 274 | 274 | ||
| 275 | - // just update the list item text in-place. | ||
| 276 | - // lists that come right after a heading are what we're after. | ||
| 275 | + // Just update the list item text in-place. | ||
| 276 | + // Lists that come right after a heading are what we're after. | ||
| 277 | 277 | function parseLists(input) { | |
| 278 | 278 | var state = null; | |
| 279 | 279 | const savedState = []; | |
@@ -299,8 +299,8 @@ function parseLists(input) { | |||
| 299 | 299 | const stabilityMatch = tok.text.match(STABILITY_TEXT_REG_EXP); | |
| 300 | 300 | const stability = Number(stabilityMatch[2]); | |
| 301 | 301 | const isStabilityIndex = | |
| 302 | - index - 2 === headingIndex || // general | ||
| 303 | - index - 3 === headingIndex; // with api_metadata block | ||
| 302 | + index - 2 === headingIndex || // General. | ||
| 303 | + index - 3 === headingIndex; // With api_metadata block. | ||
| 304 | 304 | ||
| 305 | 305 | if (heading && isStabilityIndex) { | |
| 306 | 306 | heading.stability = stability; | |
@@ -408,17 +408,17 @@ function parseYAML(text) { | |||
| 408 | 408 | return html.join('\n'); | |
| 409 | 409 | } | |
| 410 | 410 | ||
| 411 | - // Syscalls which appear in the docs, but which only exist in BSD / OSX | ||
| 411 | + // Syscalls which appear in the docs, but which only exist in BSD / macOS. | ||
| 412 | 412 | const BSD_ONLY_SYSCALLS = new Set(['lchmod']); | |
| 413 | 413 | ||
| 414 | - // Handle references to man pages, eg "open(2)" or "lchmod(2)" | ||
| 415 | - // Returns modified text, with such refs replace with HTML links, for example | ||
| 416 | - // '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>' | ||
| 414 | + // Handle references to man pages, eg "open(2)" or "lchmod(2)". | ||
| 415 | + // Returns modified text, with such refs replaced with HTML links, for example | ||
| 416 | + // '<a href="http://man7.org/linux/man-pages/man2/open.2.html">open(2)</a>'. | ||
| 417 | 417 | function linkManPages(text) { | |
| 418 | 418 | return text.replace( | |
| 419 | 419 | /(^|\s)([a-z.]+)\((\d)([a-z]?)\)/gm, | |
| 420 | 420 | (match, beginning, name, number, optionalCharacter) => { | |
| 421 | - // name consists of lowercase letters, number is a single digit | ||
| 421 | + // Name consists of lowercase letters, number is a single digit. | ||
| 422 | 422 | const displayAs = `${name}(${number}${optionalCharacter})`; | |
| 423 | 423 | if (BSD_ONLY_SYSCALLS.has(name)) { | |
| 424 | 424 | return `${beginning}<a href="https://www.freebsd.org/cgi/man.cgi?query=${name}` + | |
@@ -436,7 +436,7 @@ function linkJsTypeDocs(text) { | |||
| 436 | 436 | var typeMatches; | |
| 437 | 437 | ||
| 438 | 438 | // Handle types, for example the source Markdown might say | |
| 439 | - // "This argument should be a {Number} or {String}" | ||
| 439 | + // "This argument should be a {Number} or {String}". | ||
| 440 | 440 | for (i = 0; i < parts.length; i += 2) { | |
| 441 | 441 | typeMatches = parts[i].match(/\{([^}]+)\}/g); | |
| 442 | 442 | if (typeMatches) { | |
@@ -446,7 +446,7 @@ function linkJsTypeDocs(text) { | |||
| 446 | 446 | } | |
| 447 | 447 | } | |
| 448 | 448 | ||
| 449 | - //XXX maybe put more stuff here? | ||
| 449 | + // TODO: maybe put more stuff here? | ||
| 450 | 450 | return parts.join('`'); | |
| 451 | 451 | } | |
| 452 | 452 | ||
@@ -461,7 +461,7 @@ function parseAPIHeader(text) { | |||
| 461 | 461 | return text; | |
| 462 | 462 | } | |
| 463 | 463 | ||
| 464 | - // section is just the first heading | ||
| 464 | + // Section is just the first heading. | ||
| 465 | 465 | function getSection(lexed) { | |
| 466 | 466 | for (var i = 0, l = lexed.length; i < l; i++) { | |
| 467 | 467 | var tok = lexed[i]; | |
@@ -533,7 +533,7 @@ const numberRe = /^(\d*)/; | |||
| 533 | 533 | function versionSort(a, b) { | |
| 534 | 534 | a = a.trim(); | |
| 535 | 535 | b = b.trim(); | |
| 536 | - let i = 0; // common prefix length | ||
| 536 | + let i = 0; // Common prefix length. | ||
| 537 | 537 | while (i < a.length && i < b.length && a[i] === b[i]) i++; | |
| 538 | 538 | a = a.substr(i); | |
| 539 | 539 | b = b.substr(i); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments