Skip to content
Permalink
Browse files

docs, feat: collect modules.

  • Loading branch information...
xicilion committed Jul 19, 2018
1 parent 5804005 commit ddc582ed219441ff5b619ef74264b5824e7b5366
Showing with 45 additions and 9 deletions.
  1. +10 −0 idl/zh-cn/collect.json
  2. +23 −5 tools/util/parser.js
  3. +8 −2 tools/util/tmpl/README.md
  4. +4 −2 tools/util/tmpl/SUMMARY.md
@@ -0,0 +1,10 @@
{
"System": ["console", "coroutine", "global", "gui", "os", "process", "registry", "timers", "tty"],
"File System": ["fs", "io", "path", "path_posix", "path_win32"],
"Network": ["dgram", "dns", "http", "mq", "net", "punycode", "querystring", "ssl", "url", "ws", "zmq"],
"Encoding": ["base32", "base64", "base64vlq", "bson", "encoding", "hex", "iconv", "json", "string_decoder"],
"Crypto": ["crypto", "hash"],
"Compress": ["zip", "zlib"],
"Test Suite": ["assert", "profiler", "test"],
"Utility": ["db", "gd", "util", "uuid", "vm", "xml"]
}
@@ -406,9 +406,13 @@ function parser_comment(comment) {

module.exports = function (baseFolder, defs) {
var defs1 = {};
var collect = {};

fs.readdir(baseFolder).sort().forEach(f => {
if (path.extname(f) == '.idl') {
if (f === 'collect.json') {
f = path.join(baseFolder, f);
collect = JSON.parse(fs.readTextFile(f));
} else if (path.extname(f) == '.idl') {
f = path.join(baseFolder, f);
var def = parser.parse(fs.readTextFile(f));

@@ -420,14 +424,28 @@ module.exports = function (baseFolder, defs) {
}
});

var defs2 = {};
for (var g in collect) {
collect[g].forEach(n => {
var def = defs1[n];
def.collect = g;
defs2[n] = def;
delete defs1[n];
});
}

for (var n in defs1) {
defs2[n] = defs1[n];
}

if (defs) {
for (var n in defs) {
defs[n].__skip = true;
defs1[n] = defs[n];
defs2[n] = defs[n];
}

delete defs1['object'].declare.extend;
}

return defs1;
delete defs2['object'].declare.extend;

return defs2;
};
@@ -1,5 +1,11 @@
# <%-title%>
<% for(var m in defs){
<% var now_collect = '';
for(var m in defs){
if(defs[m].declare.type == type){
%>* [<%-defs[m].declare.name%>](ifs/<%-defs[m].declare.name%>.md) - <%-defs[m].declare.doc.descript%>
if(now_collect !== defs[m].collect)
{
now_collect = defs[m].collect;
if(now_collect){%>* <%-now_collect%>
<%}}
if(now_collect){%> -<%}else{%>*<%}%> [<%-defs[m].declare.name%>](ifs/<%-defs[m].declare.name%>.md) - <%-defs[m].declare.doc.descript%>
<%}}%>
@@ -1,4 +1,6 @@
<% for(var m in defs){
<% var keys = Object.keys(defs);
keys.sort();
keys.forEach(m => {
if(defs[m].declare.type == type){
%>* [<%-defs[m].declare.name%>](ifs/<%-defs[m].declare.name%>.md)
<%}}%>
<%}})%>

0 comments on commit ddc582e

Please sign in to comment.
You can’t perform that action at this time.