Socket
Socket
Sign inDemoInstall

apidoc-core

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apidoc-core - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

56

lib/index.js
var _ = require('lodash');
var fs = require('fs');
var os = require('os');
var path = require('path');

@@ -20,3 +21,3 @@ var semver = require('semver');

excludeFilters: [],
includeFilters: [ '.*\\.(clj|coffee|cs|dart|erl|go|java|js|php?|py|rb|ts|pm)$' ],
includeFilters: [ '.*\\.(clj|coffee|cs|dart|erl|go|java|js|litcoffee|php?|py|rb|scala|ts|pm)$' ],

@@ -28,11 +29,13 @@ src: path.join(__dirname, '../example/'),

parsers: {},
workers: {}
workers: {},
lineEnding: detectLineEnding()
};
var app = {
options : {},
options : {}, // see defaults
log : logger,
generator : {},
packageInfos: {},
markdown : false,
markdownParser: false,
filters: {

@@ -48,2 +51,3 @@ apierror : './filters/api_error.js',

'.erl' : './languages/erl.js',
'.litcoffee' : './languages/coffee.js',
'.pm' : './languages/pm.js',

@@ -57,18 +61,8 @@ '.py' : './languages/py.js',

apidefine : './parsers/api_define.js',
apidefineerrorstructure : './parsers/api_define_error_structure.js',
apidefineheaderstructure : './parsers/api_define_header_structure.js',
apidefinepermission : './parsers/api_define_permission.js',
apidefinestructure : './parsers/api_define_structure.js',
apidefinesuccessstructure: './parsers/api_define_success_structure.js',
apigroupdescription : './parsers/api_group_description.js',
apidescription : './parsers/api_description.js',
apierror : './parsers/api_error.js',
apierrorexample : './parsers/api_error_example.js',
apierrorstructure : './parsers/api_error_structure.js',
apierrortitle : './parsers/api_error_title.js',
apiexample : './parsers/api_example.js',
apiheader : './parsers/api_header.js',
apiheaderexample : './parsers/api_header_example.js',
apiheaderstructure : './parsers/api_header_structure.js',
apiheadertitle : './parsers/api_header_title.js',
apigroup : './parsers/api_group.js',

@@ -78,9 +72,5 @@ apiname : './parsers/api_name.js',

apiparamexample : './parsers/api_param_example.js',
apiparamtitle : './parsers/api_param_title.js',
apipermission : './parsers/api_permission.js',
apistructure : './parsers/api_structure.js',
apisuccess : './parsers/api_success.js',
apisuccessexample : './parsers/api_success_example.js',
apisuccessstructure : './parsers/api_success_structure.js',
apisuccesstitle : './parsers/api_success_title.js',
apiuse : './parsers/api_use.js',

@@ -103,8 +93,3 @@ apiversion : './parsers/api_version.js',

apisuccesstitle : './workers/api_success_title.js',
apiuse : './workers/api_use.js',
deprecatedApiErrorTitle : './workers/deprecated_api_error_title.js',
deprecatedApiHeaderTitle : './workers/deprecated_api_header_title.js',
deprecatedApiParamTitle : './workers/deprecated_api_param_title.js',
deprecatedApiSuccessTitle: './workers/deprecated_api_success_title.js'
apiuse : './workers/api_use.js'
}

@@ -147,2 +132,15 @@ };

/**
* Detect and return OS specific line ending.
*
* @returns {String}
*/
function detectLineEnding() {
if ( os.platform() === 'win32' )
return '\r\n';
if ( os.platform() === 'darwin' )
return '\r';
return '\n';
}
/**
* Parser

@@ -240,7 +238,7 @@ *

var apiData = JSON.stringify(blocks, null, 2);
apiData = apiData.replace(/(\r\n|\n|\r)/g, '\r\n');
apiData = apiData.replace(/(\r\n|\n|\r)/g, app.options.lineEnding);
// api_project
var apiProject = JSON.stringify(app.packageInfos, null, 2);
apiProject = apiProject.replace(/(\r\n|\n|\r)/g, '\r\n');
apiProject = apiProject.replace(/(\r\n|\n|\r)/g, app.options.lineEnding);

@@ -335,6 +333,6 @@ return {

*
* @param {Object} [markdown] Markdown parser.
* @param {Object} [markdownParser] Markdown parser.
*/
function setMarkdownParser(markdown) {
app.markdown = markdown;
function setMarkdownParser(markdownParser) {
app.markdownParser = markdownParser;
}

@@ -341,0 +339,0 @@

@@ -223,4 +223,4 @@ var _ = require('lodash');

if (values) {
// Markdown
if ( app.markdown &&
// Markdown.
if ( app.markdownParser &&
elementParser.markdownFields &&

@@ -232,3 +232,3 @@ elementParser.markdownFields.length > 0

if (values[field]) {
values[field] = app.markdown(values[field]);
values[field] = app.markdownParser.render(values[field]);
// remove line breaks

@@ -235,0 +235,0 @@ values[field] = values[field].replace(/(\r\n|\n|\r)/g, ' ');

@@ -19,3 +19,3 @@ // Same as @apiParam

method : apiParser.method,
markdownFields: [ 'description' ]
markdownFields: [ 'description', 'type' ]
};

@@ -24,3 +24,3 @@ var trim = require('../utils/trim');

b: '\\s*(?:\\{\\s*', // starting with '{', optional surrounding spaces
type: '([a-zA-Z0-9\\.\\/\\\\\\[\\]_-]+)', // 2
type: '([a-zA-Z0-9\(\)#:\\.\\/\\\\\\[\\]_-]+)', // 2
oSize: { // optional size within type: {string{1..4}}

@@ -136,3 +136,3 @@ b: '\\s*(?:\\{\\s*', // starting with '{', optional surrounding spaces

getGroup : getGroup,
markdownFields: [ 'description' ]
markdownFields: [ 'description', 'type' ]
};

@@ -19,3 +19,3 @@ // Same as @apiParam

method : apiParser.method,
markdownFields: [ 'description' ]
markdownFields: [ 'description', 'type' ]
};
{
"name": "apidoc-core",
"version": "0.3.2",
"version": "0.4.0",
"description": "Core parser library to generate apidoc result following the apidoc-spec",

@@ -36,4 +36,4 @@ "author": "Peter Rottmann <rottmann@inveris.de>",

"dependencies": {
"lodash": "~3.6.0",
"semver": "~4.3.3",
"lodash": "~3.8.0",
"semver": "~4.3.4",
"wrench": "~1.5.8"

@@ -44,3 +44,3 @@ },

"jshint": "~2.7.0",
"marked": "~0.3.3",
"markdown-it": "^4.2.1",
"mocha": "~2.2.4",

@@ -47,0 +47,0 @@ "npm-check-updates": "^1.5.1",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc