Permalink
Browse files

Remove p-Tags from type-Field. Update test and deps.

  • Loading branch information...
1 parent a2acc02 commit adef48699834cddacdd7c6732a84256f170f5750 @rottmann rottmann committed Dec 14, 2015
Showing with 25 additions and 11 deletions.
  1. +11 −0 lib/parser.js
  2. +2 −1 lib/parsers/api_error.js
  3. +2 −1 lib/parsers/api_param.js
  4. +2 −1 lib/parsers/api_success.js
  5. +7 −7 package.json
  6. +1 −1 test/apidoc_test.js
View
@@ -231,6 +231,17 @@ Parser.prototype._parseBlockElements = function(indexApiBlocks, detectedElements
values[field] = app.markdownParser.render(values[field]);
// remove line breaks
values[field] = values[field].replace(/(\r\n|\n|\r)/g, ' ');
+
+ values[field] = values[field].trim();
+
+ // TODO: Little hacky, not sure to handle this here or in template
+ if ( elementParser.markdownRemovePTags &&
+ elementParser.markdownRemovePTags.length > 0 &&
+ elementParser.markdownRemovePTags.indexOf(field) !== -1
+ ) {
+ // Remove p-Tags
+ values[field] = values[field].replace(/(<p>|<\/p>)/g, '');
+ }
}
}
}
@@ -16,5 +16,6 @@ module.exports = {
parse : parse,
path : path,
method : apiParser.method,
- markdownFields: [ 'description', 'type' ]
+ markdownFields: [ 'description', 'type' ],
+ markdownRemovePTags: [ 'type' ]
};
@@ -132,5 +132,6 @@ module.exports = {
path : path,
method : 'push',
getGroup : getGroup,
- markdownFields: [ 'description', 'type' ]
+ markdownFields: [ 'description', 'type' ],
+ markdownRemovePTags: [ 'type' ]
};
@@ -16,5 +16,6 @@ module.exports = {
parse : parse,
path : path,
method : apiParser.method,
- markdownFields: [ 'description', 'type' ]
+ markdownFields: [ 'description', 'type' ],
+ markdownRemovePTags: [ 'type' ]
};
View
@@ -33,17 +33,17 @@
"node": ">= 0.10.0"
},
"dependencies": {
- "lodash": "~3.8.0",
- "semver": "~4.3.4",
+ "lodash": "~3.10.1",
+ "semver": "~5.1.0",
"wrench": "~1.5.8"
},
"devDependencies": {
"apidoc-example": "*",
- "jshint": "~2.7.0",
- "markdown-it": "^4.2.1",
- "mocha": "~2.2.4",
- "npm-check-updates": "^1.5.1",
- "should": "~6.0.1"
+ "jshint": "~2.9.1-rc1",
+ "markdown-it": "^5.0.2",
+ "mocha": "~2.3.4",
+ "npm-check-updates": "^2.5.4",
+ "should": "~8.0.1"
},
"jshintConfig": {
"camelcase": true,
View
@@ -114,7 +114,7 @@ describe('apiDoc full parse', function() {
var name = fixturePath + '/' + file.filename;
var fixtureContent = fs.readFileSync(name, 'utf8');
- var createdContent = api[key];
+ var createdContent = api[key] + '\n'; // add linebreak at the end
// creation time remove (never equal)
fixtureContent = fixtureContent.replace(timeRegExp, '');

0 comments on commit adef486

Please sign in to comment.