-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jsdocs api plugins generation script
- Loading branch information
1 parent
07665dd
commit 9a44dae
Showing
14 changed files
with
326 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"source": { | ||
"include": ["../../../../sdkjs/cell/api_plugins.js"] | ||
}, | ||
"plugins": ["./correct_doclets.js"], | ||
"opts": { | ||
"destination": "./out", | ||
"recurse": true, | ||
"encoding": "utf8" | ||
}, | ||
"templates": { | ||
"json": { | ||
"pretty": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"source": { | ||
"include": ["../../../../sdkjs/common/plugins/plugin_base_api.js" ,"../../../../sdkjs/common/apiBase_plugins.js"] | ||
}, | ||
"plugins": ["./correct_doclets.js"], | ||
"opts": { | ||
"destination": "./out", | ||
"recurse": true, | ||
"encoding": "utf8" | ||
}, | ||
"templates": { | ||
"json": { | ||
"pretty": true | ||
} | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
scripts/sdkjs_common/jsdoc/config/plugins/correct_doclets.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
exports.handlers = { | ||
processingComplete: function(e) { | ||
const filteredDoclets = []; | ||
|
||
function checkNullProps(oDoclet) { | ||
for (let key of Object.keys(oDoclet)) { | ||
if (oDoclet[key] == null) { | ||
delete oDoclet[key]; | ||
} | ||
if (typeof(oDoclet[key]) == "object") { | ||
checkNullProps(oDoclet[key]); | ||
} | ||
} | ||
} | ||
|
||
for (let i = 0; i < e.doclets.length; i++) { | ||
const doclet = e.doclets[i]; | ||
if (true == doclet.undocumented || doclet.kind == 'package') { | ||
continue; | ||
} | ||
|
||
const filteredDoclet = { | ||
comment: doclet.comment, | ||
|
||
meta: doclet.meta ? { | ||
lineno: doclet.meta.lineno, | ||
columnno: doclet.meta.columnno | ||
} : doclet.meta, | ||
|
||
kind: doclet.kind, | ||
since: doclet.since, | ||
name: doclet.name, | ||
type: doclet.type ? { | ||
names: doclet.type.names, | ||
parsedType: doclet.type.parsedType | ||
} : doclet.type, | ||
|
||
description: doclet.description, | ||
memberof: doclet.memberof, | ||
|
||
properties: doclet.properties ? doclet.properties.map(property => ({ | ||
type: property.type ? { | ||
names: property.type.names, | ||
parsedType: property.type.parsedType | ||
} : property.type, | ||
|
||
name: property.name, | ||
description: property.description, | ||
optional: property.optional, | ||
defaultvalue: property.defaultvalue | ||
})) : doclet.properties, | ||
|
||
longname: doclet.longname, | ||
scope: doclet.scope, | ||
alias: doclet.alias, | ||
|
||
params: doclet.params ? doclet.params.map(param => ({ | ||
type: param.type ? { | ||
names: param.type.names, | ||
parsedType: param.type.parsedType | ||
} : param.type, | ||
|
||
name: param.name, | ||
description: param.description, | ||
optional: param.optional, | ||
defaultvalue: param.defaultvalue | ||
})) : doclet.params, | ||
|
||
returns: doclet.returns ? doclet.returns.map(returnObj => ({ | ||
type: { | ||
names: returnObj.type.names, | ||
parsedType: returnObj.type.parsedType | ||
} | ||
})) : doclet.returns, | ||
see: doclet.see | ||
}; | ||
|
||
checkNullProps(filteredDoclet) | ||
|
||
filteredDoclets.push(filteredDoclet); | ||
} | ||
|
||
e.doclets.splice(0, e.doclets.length, ...filteredDoclets); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"source": { | ||
"include": ["../../../../sdkjs-forms/apiPlugins.js"] | ||
}, | ||
"plugins": ["./correct_doclets.js"], | ||
"opts": { | ||
"destination": "./out", | ||
"recurse": true, | ||
"encoding": "utf8" | ||
}, | ||
"templates": { | ||
"json": { | ||
"pretty": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"source": { | ||
"include": ["../../../../sdkjs/slide/api_plugins.js"] | ||
}, | ||
"plugins": ["./correct_doclets.js"], | ||
"opts": { | ||
"destination": "./out", | ||
"recurse": true, | ||
"encoding": "utf8" | ||
}, | ||
"templates": { | ||
"json": { | ||
"pretty": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"source": { | ||
"include": ["../../../../sdkjs/word/api_plugins.js", "../../../../sdkjs-forms/apiPlugins.js"] | ||
}, | ||
"plugins": ["./correct_doclets.js"], | ||
"opts": { | ||
"destination": "./out", | ||
"recurse": true, | ||
"encoding": "utf8" | ||
}, | ||
"templates": { | ||
"json": { | ||
"pretty": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.