apidoc-core
Advanced tools
Comparing version 0.10.0 to 0.11.0
# Changelog for apidoc-core | ||
## 0.11.0 | ||
### Added | ||
* Allow filtering by tag (PR #91 by @omaretna) | ||
### Fixed | ||
* Fix apiprivate parser issue (PR #81 by @jason-gao) | ||
## 0.10.0 | ||
@@ -4,0 +14,0 @@ |
@@ -81,3 +81,4 @@ var _ = require('lodash'); | ||
apisamplerequest : './parsers/api_sample_request.js', | ||
apideprecated : './parsers/api_deprecated.js' | ||
apideprecated : './parsers/api_deprecated.js', | ||
apiprivate : './parsers/api_private.js', | ||
}, | ||
@@ -84,0 +85,0 @@ workers: { |
@@ -13,2 +13,3 @@ var _ = require('lodash'); | ||
var app = {}; | ||
var filterTag = null; // define the tag to filter by | ||
@@ -53,2 +54,8 @@ function Parser(_app) { | ||
}); | ||
// check app.options.filterBy and define the tag to filter by | ||
if (app.options.filterBy) { | ||
var tag = app.options.filterBy.split('=')[0]; | ||
filterTag = (tag.indexOf('api') !== -1) ? tag : null; | ||
} | ||
} | ||
@@ -415,4 +422,8 @@ | ||
var foundIndexes = []; | ||
// get value to filter by | ||
var valueTofilter = (filterTag) ? app.options.filterBy.split('=')[1] : null; | ||
for (var i = 0; i < blocks.length; i += 1) { | ||
var found = false; | ||
var isToFilterBy = false; | ||
var isDefine = false; | ||
for (var j = 0; j < blocks[i].length; j += 1) { | ||
@@ -433,5 +444,22 @@ // check apiIgnore | ||
// check if the user want to filter by some specific tag | ||
if (filterTag) { | ||
// we need to add all apidefine | ||
if (blocks[i][j].name.substr(0, 9) === 'apidefine') { | ||
isDefine = true; | ||
} | ||
if (blocks[i][j].name.substr(0, filterTag.length) === filterTag && blocks[i][j].content === valueTofilter) { | ||
isToFilterBy = true; | ||
} | ||
} | ||
if (blocks[i][j].name.substr(0, 3) === 'api') | ||
found = true; | ||
} | ||
// add block if it's apidefine or the tag is equal to the value defined in options | ||
if (filterTag) { | ||
found = found && (isToFilterBy || isDefine); | ||
} | ||
if (found) { | ||
@@ -438,0 +466,0 @@ foundIndexes.push(i); |
@@ -0,0 +0,0 @@ var trim = require('../utils/trim'); |
@@ -32,5 +32,13 @@ /** | ||
} else { | ||
var url; | ||
if (packageInfos.sampleUrl && block.local && block.local.url) { | ||
// if the block local url is absolute, just use this don't append to the sampleUrl | ||
if (block.local.url.length >= 4 && block.local.url.substr(0, 4).toLowerCase() !== 'http') { | ||
url = packageInfos.sampleUrl + block.local.url; | ||
} else { | ||
url = block.local.url; | ||
} | ||
block.local[targetName] = [{ | ||
'url': packageInfos.sampleUrl + block.local.url | ||
'url': url | ||
}]; | ||
@@ -37,0 +45,0 @@ } |
{ | ||
"name": "apidoc-core", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"description": "Core parser library to generate apidoc result following the apidoc-spec", | ||
@@ -40,3 +40,3 @@ "author": "Peter Rottmann <rottmann@inveris.de>", | ||
"devDependencies": { | ||
"apidoc-example": "*", | ||
"apidoc-example": "^0.2.1", | ||
"jshint": "~2.10.2", | ||
@@ -43,0 +43,0 @@ "markdown-it": "^10.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112606
64
2890