diff options
author | Sam Ruby <rubys@intertwingly.net> | 2018-07-03 12:46:56 -0400 |
---|---|---|
committer | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2018-07-09 22:57:33 +0300 |
commit | 0c743b5f77a53f278d6d6554e69d2d55ef945f66 (patch) | |
tree | 18e34392c8f668d5c3777b259785c86606ede358 /tools/doc/allhtml.js | |
parent | 1529ef4dc5e4cf99ea964bc1cc47cd62cca17540 (diff) | |
download | android-node-v8-0c743b5f77a53f278d6d6554e69d2d55ef945f66.tar.gz android-node-v8-0c743b5f77a53f278d6d6554e69d2d55ef945f66.tar.bz2 android-node-v8-0c743b5f77a53f278d6d6554e69d2d55ef945f66.zip |
tools: build all.json by combining generated JSON
Notes:
1) Removed a number of root properties that did not seem relevant:
source, desc, and introduced_in. There no longer is a source, and
the other two are from the first include and do not reflect the
entire API.
2) As with https://github.com/nodejs/node/issues/20100, the current
"desc" properties sometimes contained in-page links, other times
referenced another page, and often did not match the links in the
original HTML or JSON file. I chose to standardize on external links
as "desc" values are isolated snippets as opposed to all.html which
can be viewed as a standalone and self contained document.
3) Eliminated preprocessing for @include entirely, including the test
case for this function.
4) _toc.md was renamed to index.md.
5) index comments no longer appear in embedded TOCs (left hand side
column in the generated documentation.
PR-URL: https://github.com/nodejs/node/pull/21637
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'tools/doc/allhtml.js')
-rw-r--r-- | tools/doc/allhtml.js | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/tools/doc/allhtml.js b/tools/doc/allhtml.js index fad530f1c4..1c84e13d0a 100644 --- a/tools/doc/allhtml.js +++ b/tools/doc/allhtml.js @@ -12,7 +12,7 @@ const htmlFiles = fs.readdirSync(source, 'utf8') .filter((name) => name.includes('.html') && name !== 'all.html'); // Read the table of contents. -const toc = fs.readFileSync(source + '/_toc.html', 'utf8'); +const toc = fs.readFileSync(source + '/index.html', 'utf8'); // Extract (and concatenate) the toc and apicontent from each document. let contents = ''; @@ -47,11 +47,12 @@ for (const link of toc.match(/<a.*?>/g)) { seen[href] = true; } -// Replace various mentions of _toc with all. -let all = toc.replace(/_toc\.html/g, 'all.html') - .replace('_toc.json', 'all.json') - .replace('api-section-_toc', 'api-section-all') - .replace('data-id="_toc"', 'data-id="all"'); +// Replace various mentions of index with all. +let all = toc.replace(/index\.html/g, 'all.html') + .replace('<a href="all.html" name="toc">', '<a href="index.html" name="toc">') + .replace('index.json', 'all.json') + .replace('api-section-index', 'api-section-all') + .replace('data-id="index"', 'data-id="all"'); // Clean up the title. all = all.replace(/<title>.*?\| /, '<title>'); |