Skip to content

Commit

Permalink
docs: update script parser for error-reporting (googleapis#2181)
Browse files Browse the repository at this point in the history
* docs: update script parser for error-reporting
* add error reporting files to ignore list
  • Loading branch information
callmehiphop authored and stephenplusplus committed Apr 4, 2017
1 parent f8cdefe commit d765148
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/docs/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Builder.prototype.build = function() {
ignore: config.IGNORE
}).map(function(file) {
var json = self.parseFile(file);
var outputFile = file.replace(/^.+src\//, '') + 'on';
var outputFile = path.basename(file) + 'on';

json.path = path.basename(outputFile);
self.write(outputFile, json);
Expand Down
3 changes: 3 additions & 0 deletions scripts/docs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ module.exports = {
'bigtable/src/mutation.js',
'datastore/src/entity.js',
'datastore/src/request.js',
'error-reporting/src/configuration.js',
'error-reporting/src/error-router.js',
'error-reporting/src/logger.js',
'logging/src/metadata.js',
'pubsub/src/iam.js',
'spanner/src/codec.js',
Expand Down
8 changes: 7 additions & 1 deletion scripts/docs/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ function isPublic(block) {
return !block.isPrivate && !block.ignore;
}

function isMethod(block) {
var tag = block.tags[0];
return tag && tag.type !== 'typedef';
}

function detectLinks(str) {
var reg = /\[([^\]]*)]{@link ([^}]*)}/g;

Expand Down Expand Up @@ -118,7 +123,7 @@ function getName(block) {
return alias.string;
}

return block.ctx.name;
return block.ctx && block.ctx.name;
}

function getClassDesc(block) {
Expand Down Expand Up @@ -302,6 +307,7 @@ function parseFile(fileName, contents, umbrellaMode) {
parent: parent,
children: getChildren(id),
methods: comments
.filter(isMethod)
.map(createMethod.bind(null, fileName, id))
.concat(getMixinMethods(comments))
.reduce(createUniqueMethodList, [])
Expand Down

0 comments on commit d765148

Please sign in to comment.