Comparing version 0.7.2 to 0.8.0
# apiDoc Changelog | ||
#### 0.8.0 | ||
* Parameter | ||
* __Add__ as replacement for all (now) deprecated define and structure methods: | ||
* `@apiDefine` | ||
* `@apiUse` | ||
* __Deprecated__: | ||
* `@apiDefineErrorStructure` | ||
* `@apiDefineHeaderStructure` | ||
* `@apiDefinePermission` | ||
* `@apiDefineStructure` | ||
* `@apiDefineSuccessStructure` | ||
* `apiErrorTitle` | ||
* `apiErrorStructure` | ||
* `apiHeaderStructure` | ||
* `apiHeaderTitle` | ||
* `apiParamTitle` | ||
* `apiStructure` | ||
* `apiSuccessTitle` | ||
* `apiSuccessStructure` | ||
* __Remove__ unneeded methods since success and error response can be grouped: | ||
* `@apiInfo` | ||
* `@apiInfoExample` | ||
* `@apiInfoTitle` | ||
* __Add__ for consistent usage: | ||
* `@apiHeaderExample` | ||
* `@apiParamExample` | ||
* __Change__: | ||
* `@apiPermission`, multiple permission usage in a block is allowed now. Permission names must be defined with @apiDefine. | ||
* __Extend__: | ||
* `@apiParam` with size and allowed values. | ||
* CLI | ||
* Show deprecated message. Show details with `--debug` or `--verbose`. | ||
* Improved error output. | ||
* Turn off verbose output by default. | ||
* Add debug output. | ||
* Parser | ||
* Ignore other doc-language @-parameters (enables jsdoc, phpdoc, ... again). | ||
* Add apidoc specification version to project file. | ||
* Correctly handle Erlang comments. | ||
* Bugfix: Markdown error on Empty description. | ||
* Revised worker preProcess / postProcess functions. | ||
* Change parser export names. | ||
* Template | ||
* Show size and allowed values in field description. | ||
* Change template sample request to handle custom named groups. | ||
* Update template vendor files (handlebars 2, requirejs) | ||
* Added support for using path-to-regexp in sample request. | ||
* Add `jQueryAjaxSetup` to apidoc.json for setup ajax requests (http://apidocjs.com/#configuration-template-settings). | ||
* Hide the ul for tabs if no content. | ||
#### 0.7.2 | ||
@@ -28,3 +88,3 @@ | ||
Add parameter `--parse` for parse only the files and return the parsed data. | ||
Add parameter `--parse` for parse only the files and return the parsed data. | ||
@@ -88,3 +148,3 @@ Allow perl comments between "=pod" and "=cut". | ||
Add optional custom browser title with `apidoc.title` in `package.json`. | ||
Add optional url endpoint with `apidoc.url` in `package.json`. | ||
@@ -134,3 +194,3 @@ | ||
Add support for CoffeeScript comment-style. | ||
Add support for CoffeeScript comment-style. | ||
@@ -137,0 +197,0 @@ |
@@ -5,2 +5,17 @@ # apiDoc Contributors | ||
* [Peter Wong](https://github.com/peterwongpp) | ||
* Hide the ul for tabs if no content [#142] (https://github.com/apidoc/apidoc/pull/142)) | ||
* [Bip Thelin](https://github.com/bipthelin) | ||
* Correctly handle Erlang comments [#135] (https://github.com/apidoc/apidoc/pull/135)) | ||
* [Michael Schnyder](https://github.com/michaelschnyder) | ||
* Improvements to the Testclient [#132] (https://github.com/apidoc/apidoc/pull/132)) | ||
* [Peter Gfader](https://github.com/peitor) | ||
* Show error "responseText" on displayError [#129] (https://github.com/apidoc/apidoc/pull/129)) | ||
* [cjbarth](https://github.com/cjbarth) | ||
* Added support for using path-to-regexp in template [#119] (https://github.com/apidoc/apidoc/pull/119)) | ||
* [Brian Horakh](https://github.com/brianhorakh) | ||
@@ -7,0 +22,0 @@ * Perl - allow =pod and =cut ([#103] (https://github.com/apidoc/apidoc/issues/103)) |
@@ -41,3 +41,3 @@ /* | ||
plusplus: true, | ||
quotmark: "double", | ||
// quotmark: "double", | ||
regexp: false, | ||
@@ -70,3 +70,3 @@ undef: false, | ||
}, | ||
all: { src: ["test/apidoc_test.js"] } | ||
all: { src: ["test/*_test.js"] } | ||
} // simplemocha | ||
@@ -89,3 +89,3 @@ }); // grunt.initConfig | ||
// Task: test | ||
grunt.registerTask("test", ["clean", "simplemocha"]); | ||
grunt.registerTask("test", ["clean", "jshint", "simplemocha"]); | ||
}; |
@@ -1,30 +0,38 @@ | ||
var _ = require("underscore"); | ||
var path = require("path"); | ||
var semver = require("semver"); | ||
var PackageInfo = require("./package_info"); | ||
var Parser = require("./parser"); | ||
var Worker = require("./worker"); | ||
var Filter = require("./filter"); | ||
var colors = require("colors"); | ||
var fs = require("fs-extra"); | ||
var _ = require('lodash'); | ||
var path = require('path'); | ||
var semver = require('semver'); | ||
var PackageInfo = require('./package_info'); | ||
var Parser = require('./parser'); | ||
var Worker = require('./worker'); | ||
var Filter = require('./filter'); | ||
var colors = require('colors');var fs = require('fs-extra'); | ||
var logger = require('./utils/console_logger'); | ||
var FileError = require('./errors/file_error'); | ||
var ParameterError = require('./errors/parameter_error'); | ||
var ParserError = require('./errors/parser_error'); | ||
var WorkerError = require('./errors/worker_error'); | ||
// const | ||
var APIDOC_SPECIFICATION_VERSION = '0.2.0'; | ||
// Options | ||
var _defaultOptions = { | ||
excludeFilters: [], | ||
includeFilters: [ ".*\\.(coffee|cs|dart|erl|go|java|js|php?|py|rb|ts|pm)$" ], | ||
src: path.join(__dirname, "../example/"), | ||
dest: path.join(__dirname, "../doc/"), | ||
includeFilters: [ '.*\\.(coffee|cs|dart|erl|go|java|js|php?|py|rb|ts|pm)$' ], | ||
src: path.join(__dirname, '../example/'), | ||
dest: path.join(__dirname, '../doc/'), | ||
debug: false, | ||
log: true, | ||
silent: false, | ||
verbose: false, | ||
simulate: false, | ||
parse: false, // only parse and return the data, no file creation | ||
template: path.join(__dirname, "../template/"), | ||
template: path.join(__dirname, '../template/'), | ||
filters: {}, | ||
parsers: {}, | ||
workers: {}, | ||
marked: { | ||
@@ -44,98 +52,74 @@ gfm: true, | ||
// uncaughtException | ||
process.on("uncaughtException", function(err) { | ||
console.error((new Date()).toUTCString() + " uncaughtException:", err.message); | ||
console.error(err.stack); | ||
process.exit(1); | ||
}); | ||
/** | ||
* Output Debug-Messages | ||
* | ||
* @param {String} message | ||
*/ | ||
function debug(message) | ||
{ | ||
if (options.debug) console.log("apidoc: " + message); | ||
} // debug | ||
/** | ||
* Output Log-Messages | ||
* | ||
* @param {String} message | ||
*/ | ||
function log(message) | ||
{ | ||
if (options.log) console.log("apidoc: " + message); | ||
} // log | ||
/** | ||
* Output Error-Log-Messages | ||
* | ||
* @param {String} message | ||
*/ | ||
function logWarn(message) | ||
{ | ||
if (options.log) console.warn("apidoc: " + message.yellow); | ||
} // logWarn | ||
var app = { | ||
debug: debug, | ||
log: log, | ||
logWarn: logWarn, | ||
log: logger, | ||
options: options, | ||
filters: { | ||
apierror : "./filters/api_error.js", | ||
apiinfo : "./filters/api_info.js", | ||
apiparam : "./filters/api_param.js", | ||
apisuccess : "./filters/api_success.js" | ||
apierror : './filters/api_error.js', | ||
apiheader : './filters/api_header.js', | ||
apiparam : './filters/api_param.js', | ||
apisuccess : './filters/api_success.js' | ||
}, | ||
parsers: { | ||
api : "./parsers/api.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", | ||
apiinfo : "./parsers/api_info.js", | ||
apiinfoexample : "./parsers/api_info_example.js", | ||
apiinfotitle : "./parsers/api_info_title.js", | ||
apiname : "./parsers/api_name.js", | ||
apiparam : "./parsers/api_param.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", | ||
apiversion : "./parsers/api_version.js", | ||
apisamplerequest : "./parsers/api_sample_request.js" | ||
api : './parsers/api.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', | ||
apiname : './parsers/api_name.js', | ||
apiparam : './parsers/api_param.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', | ||
apiversion : './parsers/api_version.js', | ||
apisamplerequest : './parsers/api_sample_request.js' | ||
}, | ||
workers: { | ||
apierrorstructure : "./workers/api_error_structure.js", | ||
apierrortitle : "./workers/api_error_title.js", | ||
apiheaderstructure : "./workers/api_header_structure.js", | ||
apiheadertitle : "./workers/api_header_title.js", | ||
apiparamtitle : "./workers/api_param_title.js", | ||
apipermission : "./workers/api_permission.js", | ||
apisamplerequest : "./workers/api_sample_request.js", | ||
apistructure : "./workers/api_structure.js", | ||
apisuccessstructure : "./workers/api_success_structure.js", | ||
apisuccesstitle : "./workers/api_success_title.js" | ||
apierrorstructure : './workers/api_error_structure.js', | ||
apierrortitle : './workers/api_error_title.js', | ||
apigroup : './workers/api_group.js', | ||
apiheaderstructure : './workers/api_header_structure.js', | ||
apiheadertitle : './workers/api_header_title.js', | ||
apiname : './workers/api_name.js', | ||
apiparamtitle : './workers/api_param_title.js', | ||
apipermission : './workers/api_permission.js', | ||
apisamplerequest : './workers/api_sample_request.js', | ||
apistructure : './workers/api_structure.js', | ||
apisuccessstructure : './workers/api_success_structure.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' | ||
} | ||
}; // app | ||
// uncaughtException | ||
process.on('uncaughtException', function(err) { | ||
console.error((new Date()).toUTCString() + ' uncaughtException:', err.message); | ||
console.error(err.stack); | ||
process.exit(1); | ||
}); | ||
/** | ||
@@ -145,14 +129,14 @@ * Parser | ||
* @param {Object} defaults Overwrite default options. | ||
* @return {Mixed} False on error | 0 = nothing todo | 1 = everything ok | List of Parsed files (if parse is set). | ||
* @returns {Mixed} False on error | 0 = nothing todo | 1 = everything ok | List of Parsed files (if parse is set). | ||
*/ | ||
function parse(defaults) | ||
{ | ||
function parse(defaults) { | ||
// bin-parameters | ||
if (defaults) options = _.defaults(defaults, options); | ||
if (defaults) | ||
options = _.defaults(defaults, options); | ||
// Paths | ||
options.dest = path.join(options.dest, "./"); | ||
options.template = path.join(options.template, "./"); | ||
options.dest = path.join(options.dest, './'); | ||
options.template = path.join(options.template, './'); | ||
// Extend with custom functions | ||
// extend with custom functions | ||
app.filters = _.defaults(options.filters, app.filters); | ||
@@ -165,18 +149,24 @@ app.parsers = _.defaults(options.parsers, app.parsers); | ||
var packageInfo = new PackageInfo(app); | ||
var parser = new Parser(app); | ||
// Log | ||
app.log.setDebug(app.options.debug); | ||
app.log.setSilent(app.options.silent); | ||
app.log.setVerbose(app.options.verbose); | ||
var parsedFiles = []; | ||
var parsedFilenames = []; | ||
var worker = new Worker(app); | ||
var filter = new Filter(app); | ||
try { | ||
// If input option for source is an array of folders, | ||
var packageInfo = new PackageInfo(app); | ||
var parser = new Parser(app); | ||
var worker = new Worker(app); | ||
var filter = new Filter(app); | ||
// If input option for source is an array of folders, | ||
// parse each folder in the order provided. | ||
if (options.src instanceof Array) { | ||
options.src.forEach(function(folder) { | ||
// Keep same options for each folder, but ensure the "src" of options | ||
// Keep same options for each folder, but ensure the 'src' of options | ||
// is the folder currently being processed. | ||
var folderOptions = options; | ||
folderOptions.src = path.join(folder, "./"); | ||
folderOptions.src = path.join(folder, './'); | ||
parser.parseFiles(folderOptions, parsedFiles, parsedFilenames); | ||
@@ -187,24 +177,64 @@ }); | ||
// If the input option for source is a single folder, parse as usual. | ||
options.src = path.join(options.src, "./"); | ||
options.src = path.join(options.src, './'); | ||
parser.parseFiles(options, parsedFiles, parsedFilenames); | ||
} | ||
// Worker / Filter | ||
if (parsedFiles.length > 0) { | ||
var packageInfos = packageInfo.get(); | ||
// process transformations and assignments | ||
worker.process(parsedFiles, parsedFilenames, packageInfos); | ||
filter.process(parsedFiles, parsedFilenames); | ||
return createOutputFiles(parsedFiles, parsedFilenames, packageInfos); | ||
// cleanup | ||
var blocks = filter.process(parsedFiles, parsedFilenames); | ||
// create files | ||
var result = createOutputFiles(blocks, packageInfos); | ||
app.log.success('Done.'); | ||
return result; | ||
} else { | ||
app.log("Nothing to do."); | ||
app.log.success('Nothing to do.'); | ||
return 0; | ||
} | ||
} catch(e) { | ||
if (e.stack) app.debug(e.stack); | ||
app.log(e); | ||
// display error by instance | ||
if (e instanceof FileError) { | ||
var extra = []; | ||
extra.push({ 'Path': e.path }); | ||
app.log.error(e.message, extra); | ||
} else if (e instanceof ParserError) { | ||
var extra = e.extra; | ||
if (e.source) | ||
extra.unshift({ 'Source': e.source }); | ||
if (e.element) | ||
extra.unshift({ 'Element': '@' + e.element }); | ||
if (e.block) | ||
extra.unshift({ 'Block': e.block }); | ||
if (e.file) | ||
extra.unshift({ 'File': e.file }); | ||
app.log.error(e.message, extra); | ||
} | ||
else if (e instanceof WorkerError) { | ||
var extra = e.extra; | ||
if (e.definition) | ||
extra.push({ 'Definition': e.definition }); | ||
if (e.example) | ||
extra.push({ 'Example': e.example }); | ||
extra.unshift({ 'Element': '@' + e.element }); | ||
extra.unshift({ 'Block': e.block }); | ||
extra.unshift({ 'File': e.file }); | ||
app.log.error(e.message, extra); | ||
} | ||
else { | ||
if (e.stack) | ||
app.log.debug(e.stack); | ||
app.log.error(e); | ||
} | ||
// bubble error | ||
throw e; | ||
} | ||
return; | ||
} // parse | ||
} | ||
@@ -214,50 +244,16 @@ /** | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {Object[]} blocks | ||
* @param {String[]} filenames | ||
* @returns {Object} | ||
*/ | ||
function createOutputFiles(parsedFiles, parsedFilenames, packageInfos) | ||
{ | ||
// TODO the following logic should be placed in parser | ||
var blocks = []; | ||
// Reduce to get only local blocks. | ||
for (var fileIndex = 0; fileIndex < parsedFiles.length; fileIndex += 1) { | ||
var parsedFile = parsedFiles[fileIndex]; | ||
for (var blockIndex = 0; blockIndex < parsedFile.length; blockIndex += 1) { | ||
var block = parsedFile[blockIndex]; | ||
// "<= 1" if successTitle gets removed, empty Object remain. | ||
if (Object.keys(block.global).length <= 1 && Object.keys(block.local).length > 0) { | ||
// Add needed Elements for sorting | ||
if ( ! block.local.group) { | ||
block.local.group = path.basename( parsedFilenames[fileIndex] ); | ||
// Replace special chars | ||
// TODO: check & escape all other fields -> in template? | ||
block.local.group = block.local.group.replace(/[.]/g, "_"); | ||
} | ||
if ( ! block.local.type) block.local.type = ""; | ||
if ( ! block.local.url) block.local.url = ""; | ||
if ( ! block.local.version) block.local.version = "0.0.0"; | ||
// Info Element | ||
if ( ! block.local.filename) block.local.filename = parsedFilenames[fileIndex]; | ||
// Convert dir delimeter \\ to / | ||
block.local.filename = block.local.filename.replace(/\\/g, "/"); | ||
blocks.push(block.local); | ||
} | ||
} // for blockIndex | ||
} // for fileIndex | ||
// Empty | ||
parsedFiles = null; | ||
parsedFilenames = null; | ||
// Sort by group ASC, name ASC, version DESC | ||
function createOutputFiles(blocks, packageInfos) { | ||
// TODO: sorting after filtering | ||
// sort by group ASC, name ASC, version DESC | ||
blocks.sort(function(a, b) { | ||
var nameA = a.group + a.name; | ||
var nameB = b.group + b.name; | ||
if (nameA === nameB) { | ||
if (a.version === b.version) return 0; | ||
if (a.version === b.version) | ||
return 0; | ||
return (semver.gte(a.version, b.version)) ? -1 : 1; | ||
@@ -267,44 +263,51 @@ } | ||
}); | ||
if (options.simulate) { | ||
app.debug(""); | ||
app.debug("!!! Simulation !!! No file or dir will be copied or created."); | ||
app.debug(""); | ||
} | ||
if (options.simulate) | ||
app.log.warning('!!! Simulation !!! No file or dir will be copied or created.'); | ||
// api_data | ||
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, '\r\n'); | ||
// add apiDoc specification version | ||
packageInfos.apidoc = APIDOC_SPECIFICATION_VERSION; | ||
// api_project | ||
var apiProject = JSON.stringify(packageInfos, null, 2); | ||
apiProject = apiProject.replace(/(\r\n|\n|\r)/g, "\r\n"); | ||
if (options.parse === true) { | ||
apiProject = apiProject.replace(/(\r\n|\n|\r)/g, '\r\n'); | ||
if (options.parse === true) | ||
return { | ||
apiData: apiData, | ||
apiData : apiData, | ||
apiProject: apiProject | ||
}; | ||
} else { | ||
app.debug("create dir: " + options.dest); | ||
if ( ! options.simulate) fs.mkdirsSync(options.dest); | ||
app.debug("copy template " + options.template + " to: " + options.dest); | ||
if ( ! options.simulate) fs.copySync(options.template, options.dest); | ||
// Write api_data | ||
app.debug("write json file: " + options.dest + "api_data.json"); | ||
if( ! options.simulate) fs.writeFileSync(options.dest + "./api_data.json", apiData); | ||
app.debug("write js file: " + options.dest + "api_data.js"); | ||
if( ! options.simulate) fs.writeFileSync(options.dest + "./api_data.js", "define({ api: " + apiData + " });"); | ||
// Write api_project | ||
app.debug("write json file: " + options.dest + "api_project.json"); | ||
if( ! options.simulate) fs.writeFileSync(options.dest + "./api_project.json", apiProject); | ||
app.debug("write js file: " + options.dest + "api_project.js"); | ||
if( ! options.simulate) fs.writeFileSync(options.dest + "./api_project.js", "define(" + apiProject + ");"); | ||
} | ||
app.log.debug('create dir: ' + options.dest); | ||
if ( ! options.simulate) | ||
fs.mkdirsSync(options.dest); | ||
app.log.debug('copy template ' + options.template + ' to: ' + options.dest); | ||
if ( ! options.simulate) | ||
fs.copySync(options.template, options.dest); | ||
// Write api_data | ||
app.log.debug('write json file: ' + options.dest + 'api_data.json'); | ||
if( ! options.simulate) | ||
fs.writeFileSync(options.dest + './api_data.json', apiData); | ||
app.log.debug('write js file: ' + options.dest + 'api_data.js'); | ||
if( ! options.simulate) | ||
fs.writeFileSync(options.dest + './api_data.js', 'define({ api: ' + apiData + ' });'); | ||
// Write api_project | ||
app.log.debug('write json file: ' + options.dest + 'api_project.json'); | ||
if( ! options.simulate) | ||
fs.writeFileSync(options.dest + './api_project.json', apiProject); | ||
app.log.debug('write js file: ' + options.dest + 'api_project.js'); | ||
if( ! options.simulate) | ||
fs.writeFileSync(options.dest + './api_project.js', 'define(' + apiProject + ');'); | ||
return true; | ||
} // createOutputFiles | ||
} | ||
@@ -317,2 +320,6 @@ /** | ||
// Direct call | ||
if(path.dirname(process.argv[1]) === __dirname) parse(); | ||
if (path.dirname(process.argv[1]) === __dirname) { | ||
try { | ||
parse(); | ||
} catch (e) {} | ||
} |
@@ -1,23 +0,29 @@ | ||
var util = require("util"); | ||
var util = require('util'); | ||
var _ = require('lodash'); | ||
var app = {}; | ||
function Filter(_app) | ||
{ | ||
var self = this; | ||
/** | ||
* Filter | ||
* Cleanup the data, e.g.: remove double fields, happen when overwrite a global inherited field with a local definition. | ||
* | ||
* @param {Object} _app | ||
*/ | ||
function Filter(_app) { | ||
var self = this; | ||
// Global Variables | ||
app = _app; | ||
// global variables | ||
app = _app; | ||
// Class Variables | ||
this.filters = []; | ||
// class variables | ||
this.filters = {}; | ||
// Load Filters | ||
var filters = Object.keys(app.filters); | ||
filters.forEach(function(filter) { | ||
var filename = app.filters[filter]; | ||
app.debug("load filter: " + filter + ", " + filename); | ||
self.filters.push(require(filename)); | ||
}); | ||
} // Filter | ||
// load filters | ||
var filters = Object.keys(app.filters); | ||
filters.forEach(function(filter) { | ||
var filename = app.filters[filter]; | ||
app.log.debug('load filter: ' + filter + ', ' + filename); | ||
self.addFilter(filter, require(filename)); | ||
}); | ||
} | ||
@@ -37,6 +43,5 @@ /** | ||
*/ | ||
Filter.prototype.addFilter = function(name, filter) | ||
{ | ||
this.filters.push(filter); | ||
}; // addFiler | ||
Filter.prototype.addFilter = function(name, filter) { | ||
this.filters[name] = filter; | ||
}; | ||
@@ -46,18 +51,20 @@ /** | ||
*/ | ||
Filter.prototype.process = function(parsedFiles, parsedFilenames) | ||
{ | ||
this.filters.forEach(function(filter){ | ||
if(filter.postFilter) | ||
{ | ||
try | ||
{ | ||
filter.postFilter(parsedFiles, parsedFilenames); | ||
} | ||
catch(e) | ||
{ | ||
throw e; | ||
} | ||
Filter.prototype.process = function(parsedFiles, parsedFilenames) { | ||
// filter each @api-Parameter | ||
_.each(this.filters, function(filter, name) { | ||
if (filter.postFilter) { | ||
app.log.info('filter postFilter: ' + name); | ||
filter.postFilter(parsedFiles, parsedFilenames); | ||
} | ||
}); | ||
}; // process | ||
// reduce to local blocks where global is empty | ||
var blocks = []; | ||
parsedFiles.forEach(function(parsedFile) { | ||
parsedFile.forEach(function(block) { | ||
if (Object.keys(block.global).length === 0 && Object.keys(block.local).length > 0) | ||
blocks.push(block.local); | ||
}); | ||
}); | ||
return blocks; | ||
}; |
@@ -1,3 +0,3 @@ | ||
// Same as @apiparam | ||
var filterApiParam = require("./api_param.js"); | ||
// Same as @apiParam | ||
var filterApiParam = require('./api_param.js'); | ||
@@ -9,14 +9,12 @@ /** | ||
* @param {String[]} filenames | ||
* @returns {Object} | ||
*/ | ||
function postFilter(parsedFiles, filenames) | ||
{ | ||
filterApiParam.postFilter(parsedFiles, filenames, "error"); | ||
} // postFilter | ||
function postFilter(parsedFiles, filenames) { | ||
filterApiParam.postFilter(parsedFiles, filenames, 'error'); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
postFilter: postFilter | ||
}; | ||
}; |
@@ -1,3 +0,3 @@ | ||
// Same as @apiparam | ||
var filterApiParam = require("./api_param.js"); | ||
// Same as @apiParam | ||
var filterApiParam = require('./api_param.js'); | ||
@@ -9,14 +9,12 @@ /** | ||
* @param {String[]} filenames | ||
* @returns {Object} | ||
*/ | ||
function postFilter(parsedFiles, filenames) | ||
{ | ||
filterApiParam.postFilter(parsedFiles, filenames, "header"); | ||
} // postFilter | ||
function postFilter(parsedFiles, filenames) { | ||
filterApiParam.postFilter(parsedFiles, filenames, 'header'); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
postFilter: postFilter | ||
postFilter: postFilter | ||
}; |
/** | ||
* Post Filter parsed results. | ||
* Post Filter parsed results | ||
* Remove double fields, happen when overwrite a global inherited field with a local definition. | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {String} tagName Example: "parameter" | ||
* @param {String} tagName Example: 'parameter' | ||
* @returns {Object} | ||
* @todo Use elegant Map and Reduce Funktions. | ||
*/ | ||
function postFilter(parsedFiles, filenames, tagName) | ||
{ | ||
tagName = tagName || "parameter"; | ||
function postFilter(parsedFiles, filenames, tagName) { | ||
tagName = tagName || 'parameter'; | ||
var blockFields; | ||
var fields; | ||
var newFields; | ||
var keys; | ||
parsedFiles.forEach(function(parsedFile){ | ||
parsedFile.forEach(function(block){ | ||
if(block.local[tagName] && block.local[tagName].fields) | ||
{ | ||
blockFields = block.local[tagName].fields; | ||
Object.keys(blockFields).forEach(function(blockFieldKey){ | ||
fields = block.local[tagName].fields[blockFieldKey]; | ||
newFields = []; | ||
keys = {}; | ||
fields.forEach(function(field){ | ||
var key = field.field; | ||
if ( ! keys[key]) { | ||
keys[key] = 1; | ||
parsedFiles.forEach(function(parsedFile) { | ||
parsedFile.forEach(function(block) { | ||
if (block.local[tagName] && block.local[tagName].fields) { | ||
var blockFields = block.local[tagName].fields; | ||
Object.keys(blockFields).forEach(function(blockFieldKey) { | ||
var fields = block.local[tagName].fields[blockFieldKey]; | ||
var newFields = []; | ||
var existingKeys = {}; | ||
fields.forEach(function(field) { | ||
var key = field.field; // .field (=id) is the key to check if it exists twice | ||
if ( ! existingKeys[key]) { | ||
existingKeys[key] = 1; | ||
newFields.push(field); | ||
@@ -39,9 +33,9 @@ } | ||
}); | ||
} // postFilter | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
postFilter: postFilter | ||
}; | ||
postFilter: postFilter | ||
}; |
@@ -1,3 +0,3 @@ | ||
// Same as @apiparam | ||
var filterApiParam = require("./api_param.js"); | ||
// Same as @apiParam | ||
var filterApiParam = require('./api_param.js'); | ||
@@ -9,14 +9,12 @@ /** | ||
* @param {String[]} filenames | ||
* @returns {Object} | ||
*/ | ||
function postFilter(parsedFiles, filenames) | ||
{ | ||
filterApiParam.postFilter(parsedFiles, filenames, "success"); | ||
} // postFilter | ||
function postFilter(parsedFiles, filenames) { | ||
filterApiParam.postFilter(parsedFiles, filenames, 'success'); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
postFilter: postFilter | ||
}; | ||
postFilter: postFilter | ||
}; |
@@ -1,17 +0,16 @@ | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var util = require("util"); | ||
var _ = require("underscore"); | ||
var markdown = require("marked"); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var util = require('util'); | ||
var _ = require('lodash'); | ||
var markdown = require('marked'); | ||
var app = {}; | ||
function PackageInfo(_app) | ||
{ | ||
// Global Variables | ||
app = _app; | ||
function PackageInfo(_app) { | ||
// global variables | ||
app = _app; | ||
// marked (markdown) Settings. | ||
markdown.setOptions(app.options.marked); | ||
} // PackageInfo | ||
// marked (markdown) Settings. | ||
markdown.setOptions(app.options.marked); | ||
} | ||
@@ -31,33 +30,28 @@ /** | ||
*/ | ||
PackageInfo.prototype.get = function() | ||
{ | ||
// Read package.json | ||
var packageJsonInfo = this._readPackageData("package.json"); | ||
PackageInfo.prototype.get = function() { | ||
// Read package.json | ||
var packageJsonInfo = this._readPackageData('package.json'); | ||
// Read apidoc.json (and overwrite package.json information) | ||
var packageInfo = this._readPackageData("apidoc.json"); | ||
// Read apidoc.json (and overwrite package.json information) | ||
var packageInfo = this._readPackageData('apidoc.json'); | ||
// apidoc.json has higher priority | ||
_.defaults(packageInfo, packageJsonInfo); | ||
// apidoc.json has higher priority | ||
_.defaults(packageInfo, packageJsonInfo); | ||
if(Object.keys(packageInfo).length === 0) | ||
{ | ||
app.logWarn("Please create an apidoc.json."); | ||
} | ||
// Generator Information | ||
try | ||
{ | ||
var apidocPath = path.join(__dirname, "../"); | ||
var json = JSON.parse( fs.readFileSync(apidocPath + "package.json", "utf8") ); | ||
packageInfo.generator = { | ||
version: json.version, | ||
time: new Date() | ||
}; | ||
} | ||
catch(e) {} | ||
if (Object.keys(packageInfo).length === 0) | ||
app.log.warning('Please create an apidoc.json.'); | ||
return packageInfo; | ||
}; // get | ||
// Generator Information | ||
try { | ||
var apidocPath = path.join(__dirname, '../'); | ||
var json = JSON.parse( fs.readFileSync(apidocPath + 'package.json', 'utf8') ); | ||
packageInfo.generator = { | ||
version: json.version, | ||
time: new Date() | ||
}; | ||
} catch(e) {} | ||
return packageInfo; | ||
}; | ||
/** | ||
@@ -71,98 +65,82 @@ * Read json data from source dir, or if it not exists from current dir. | ||
*/ | ||
PackageInfo.prototype._readPackageData = function(filename) | ||
{ | ||
var packageInfo = {}; | ||
var jsonFilename = path.join(app.options.src, filename); | ||
PackageInfo.prototype._readPackageData = function(filename) { | ||
var packageInfo = {}; | ||
var jsonFilename = path.join(app.options.src, filename); | ||
// Read from source dir | ||
if( ! fs.existsSync(jsonFilename)) | ||
{ | ||
// Read vom current dir | ||
jsonFilename = "./" + filename; | ||
} | ||
if( ! fs.existsSync(jsonFilename)) | ||
{ | ||
app.debug("No " + filename + " found!"); | ||
} | ||
else | ||
{ | ||
try | ||
{ | ||
var json = JSON.parse( fs.readFileSync(jsonFilename, "utf8") ); | ||
app.debug("read: " + jsonFilename); | ||
packageInfo.name = json.name; | ||
packageInfo.version = json.version; | ||
packageInfo.description = json.description; | ||
if(json.apidoc) | ||
{ | ||
_.extend(packageInfo, this._extractApiDocJsonData(json.apidoc)); | ||
} | ||
else | ||
{ | ||
_.extend(packageInfo, this._extractApiDocJsonData(json)); | ||
} | ||
} | ||
catch (e) | ||
{ | ||
throw new Error("Can not read: " + filename + ", please check the format (e.g. missing comma)."); | ||
} | ||
} | ||
return packageInfo; | ||
}; // _readPackageData | ||
// read from source dir | ||
if ( ! fs.existsSync(jsonFilename)) { | ||
// read vom current dir | ||
jsonFilename = './' + filename; | ||
} | ||
if ( ! fs.existsSync(jsonFilename)) { | ||
app.log.debug(filename + ' not found!'); | ||
} else { | ||
try { | ||
var json = JSON.parse( fs.readFileSync(jsonFilename, 'utf8') ); | ||
app.log.debug('read: ' + jsonFilename); | ||
packageInfo.name = json.name; | ||
packageInfo.version = json.version; | ||
packageInfo.description = json.description; | ||
if(json.apidoc) | ||
_.extend(packageInfo, this._extractApiDocJsonData(json.apidoc)); | ||
else | ||
_.extend(packageInfo, this._extractApiDocJsonData(json)); | ||
} catch (e) { | ||
throw new Error('Can not read: ' + filename + ', please check the format (e.g. missing comma).'); | ||
} | ||
} | ||
return packageInfo; | ||
}; | ||
/** | ||
* Extract json parameters from the given path (json.apidoc. or json.) | ||
* | ||
* @param {Object} json | ||
* @returns {Object} | ||
*/ | ||
PackageInfo.prototype._extractApiDocJsonData = function(json) | ||
{ | ||
var packageInfo = {}; | ||
PackageInfo.prototype._extractApiDocJsonData = function(json) { | ||
var packageInfo = {}; | ||
// Browser title. | ||
packageInfo.title = json.title; | ||
// Browser title. | ||
packageInfo.title = json.title; | ||
// Template settings (without any operation, depend on the template itself) | ||
packageInfo.template = json.template; | ||
// Template settings (without any operation, depend on the template itself) | ||
packageInfo.template = json.template; | ||
// HINT: url could be replaced in the future with an @apiVariable, so versioning could be used. | ||
packageInfo.url = json.url; | ||
packageInfo.sampleUrl = json.sampleUrl; | ||
// Header | ||
// TODO: replace it later with a more flexible system to add new navigation points and content files on specific positions. | ||
if(json.header && json.header.filename) | ||
{ | ||
var filename = path.join(app.options.src, json.header.filename); | ||
if( ! fs.existsSync(filename)) | ||
{ | ||
filename = path.join("./", json.header.filename); | ||
} | ||
packageInfo.header = { | ||
title : json.header.title, | ||
content: markdown( fs.readFileSync(filename, "utf8") ) | ||
}; | ||
app.debug("read header file: " + filename); | ||
} | ||
// HINT: url could be replaced in the future with an @apiVariable, so versioning could be used. | ||
packageInfo.url = json.url; | ||
// Footer | ||
// TODO: replace it later with a more flexible system to add new navigation points and content files on specific positions. | ||
if(json.footer && json.footer.filename) | ||
{ | ||
var filename = path.join(app.options.src, json.footer.filename); | ||
if( ! fs.existsSync(filename)) | ||
{ | ||
filename = path.join("./", json.footer.filename); | ||
} | ||
packageInfo.footer = { | ||
title : json.footer.title, | ||
content: markdown( fs.readFileSync(filename, "utf8") ) | ||
}; | ||
app.debug("read footer file: " + filename); | ||
} | ||
packageInfo.sampleUrl = json.sampleUrl; | ||
return packageInfo; | ||
}; // _extractApiDocJsonData | ||
// Header | ||
// TODO: replace it later with a more flexible system to add new navigation points and content files on specific positions. | ||
if (json.header && json.header.filename) { | ||
var filename = path.join(app.options.src, json.header.filename); | ||
if ( ! fs.existsSync(filename)) | ||
filename = path.join('./', json.header.filename); | ||
packageInfo.header = { | ||
title : json.header.title, | ||
content: markdown( fs.readFileSync(filename, 'utf8') ) | ||
}; | ||
app.log.debug('read header file: ' + filename); | ||
} | ||
// Footer | ||
// TODO: replace it later with a more flexible system to add new navigation points and content files on specific positions. | ||
if (json.footer && json.footer.filename) { | ||
var filename = path.join(app.options.src, json.footer.filename); | ||
if ( ! fs.existsSync(filename)) | ||
filename = path.join('./', json.footer.filename); | ||
packageInfo.footer = { | ||
title : json.footer.title, | ||
content: markdown( fs.readFileSync(filename, 'utf8') ) | ||
}; | ||
app.log.debug('read footer file: ' + filename); | ||
} | ||
return packageInfo; | ||
}; |
@@ -1,33 +0,35 @@ | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var util = require("util"); | ||
var _ = require("underscore"); | ||
var markdown = require("marked"); | ||
var findFiles = require("./utils/find_files"); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var util = require('util'); | ||
var _ = require('lodash'); | ||
var markdown = require('marked'); | ||
var findFiles = require('./utils/find_files'); | ||
var ParameterError = require('./errors/parameter_error'); | ||
var ParserError = require('./errors/parser_error'); | ||
var app = {}; | ||
function Parser(_app) | ||
{ | ||
var self = this; | ||
function Parser(_app) { | ||
var self = this; | ||
// Global Variables | ||
app = _app; | ||
// global variables | ||
app = _app; | ||
// Class Variables | ||
self.parsers = {}; | ||
self.parsedFileElements = []; | ||
self.parsedFiles = []; | ||
// class variables | ||
self.parsers = {}; | ||
self.parsedFileElements = []; | ||
self.parsedFiles = []; | ||
self.countDeprecated = {}; | ||
// Markdown settings | ||
markdown.setOptions(app.options.marked); | ||
// markdown settings | ||
markdown.setOptions(app.options.marked); | ||
// Parser laden | ||
var parsers = Object.keys(app.parsers); | ||
parsers.forEach(function(parser) { | ||
var filename = app.parsers[parser]; | ||
app.debug("load parser: " + parser + ", " + filename); | ||
self.addParser(parser, require(filename)); | ||
}); | ||
} // Parser | ||
// load parser | ||
var parsers = Object.keys(app.parsers); | ||
parsers.forEach(function(parser) { | ||
var filename = app.parsers[parser]; | ||
app.log.debug('load parser: ' + parser + ', ' + filename); | ||
self.addParser(parser, require(filename)); | ||
}); | ||
} | ||
@@ -47,9 +49,9 @@ /** | ||
*/ | ||
Parser.prototype.addParser = function(name, parser) | ||
{ | ||
this.parsers[name] = parser; | ||
}; // addParser | ||
Parser.prototype.addParser = function(name, parser) { | ||
this.parsers[name] = parser; | ||
}; | ||
/** | ||
* Parse files in specified folder. | ||
* Parse files in specified folder | ||
* | ||
* @param {Object} options The options used to parse and filder the files. | ||
@@ -59,18 +61,21 @@ * @param {Object[]} parsedFiles List of parsed files. | ||
*/ | ||
Parser.prototype.parseFiles = function(options, parsedFiles, parsedFilenames) | ||
{ | ||
Parser.prototype.parseFiles = function(options, parsedFiles, parsedFilenames) { | ||
var self = this; | ||
var files = findFiles(options); | ||
findFiles.setPath(options.src); | ||
findFiles.setExcludeFilters(options.excludeFilters); | ||
findFiles.setIncludeFilters(options.includeFilters); | ||
var files = findFiles.search(); | ||
// Parser | ||
for(var i = 0; i < files.length; i += 1) { | ||
for (var i = 0; i < files.length; i += 1) { | ||
var filename = options.src + files[i]; | ||
var parsedFile = self.parseFile(filename); | ||
if(parsedFile) { | ||
app.log("parse file: " + filename); | ||
if (parsedFile) { | ||
app.log.info('parse file: ' + filename); | ||
parsedFiles.push(parsedFile); | ||
parsedFilenames.push(filename); | ||
} | ||
} // for | ||
}; // parseFiles | ||
} | ||
}; | ||
@@ -80,15 +85,14 @@ /** | ||
*/ | ||
Parser.prototype.parseFile = function(filename) | ||
{ | ||
Parser.prototype.parseFile = function(filename) { | ||
var self = this; | ||
app.debug("inspect file: " + filename); | ||
app.log.debug('inspect file: ' + filename); | ||
self.filename = filename; | ||
self.extension = path.extname(filename).toLowerCase(); | ||
self.src = fs.readFileSync(filename, "utf8").toString(); | ||
app.debug("size: " + self.src.length); | ||
self.src = fs.readFileSync(filename, 'utf8').toString(); | ||
app.log.debug('size: ' + self.src.length); | ||
// Unify Linebreaks | ||
self.src = self.src.replace(/\r\n/g, "\n"); | ||
// unify line-breaks | ||
self.src = self.src.replace(/\r\n/g, '\n'); | ||
@@ -98,20 +102,25 @@ self.blocks = []; | ||
// Determine Blocks | ||
// determine blocks | ||
self.blocks = self._findBlocks(); | ||
if(self.blocks.length === 0) return; | ||
app.debug("count blocks: " + self.blocks.length); | ||
if (self.blocks.length === 0) | ||
return; | ||
// Determine Elements of Blocks | ||
self.elements = self.blocks.map(function(block, i){ | ||
app.debug("count elements in block " + i + ": " + block.length); | ||
return self._findElements(block); | ||
app.log.debug('count blocks: ' + self.blocks.length); | ||
// determine elements in blocks | ||
self.elements = self.blocks.map(function(block, i) { | ||
var elements = self._findElements(block); | ||
app.log.debug('count elements in block ' + i + ': ' + elements.length); | ||
return elements; | ||
}); | ||
if(self.elements.length === 0) return; | ||
if (self.elements.length === 0) | ||
return; | ||
// Determine List of Blocks with API-Elements | ||
// determine list of blocks with API elements | ||
self.indexApiBlocks = self._findBlockWithApiGetIndex(self.elements); | ||
if(self.indexApiBlocks.length === 0) return; | ||
if (self.indexApiBlocks.length === 0) | ||
return; | ||
return self._parseBlockElements(self.indexApiBlocks, self.elements); | ||
}; // parseFile | ||
}; | ||
@@ -123,192 +132,202 @@ /** | ||
* @param detectedElements | ||
* @returns {___anonymous2249_2250} | ||
* @returns {Array} | ||
*/ | ||
Parser.prototype._parseBlockElements = function(indexApiBlocks, detectedElements) | ||
{ | ||
var self = this; | ||
var parsedBlocks = []; | ||
for(var i = 0; i < indexApiBlocks.length; i += 1) | ||
{ | ||
var blockIndex = indexApiBlocks[i]; | ||
var elements = detectedElements[blockIndex]; | ||
var blockData = { | ||
global: {}, | ||
local: {} | ||
}; | ||
var preventGlobal = false; | ||
var countAllowedMultiple = 0; | ||
for(var j = 0; j < elements.length; j += 1) | ||
{ | ||
var element = elements[j]; | ||
if(self.parsers[element.name]) | ||
{ | ||
// Determine Fieldvalues | ||
var result = null; | ||
try { | ||
result = self.parsers[element.name].parse(element.content, element.source); | ||
Parser.prototype._parseBlockElements = function(indexApiBlocks, detectedElements) { | ||
var self = this; | ||
var parsedBlocks = []; | ||
// Markdown | ||
// TODO: Evaluate if better add a function in specific worker_{name}.js | ||
if(app.options.marked.gfm && | ||
self.parsers[element.name].markdownFields && | ||
self.parsers[element.name].markdownFields.length > 0 | ||
) | ||
{ | ||
for(var markdownIndex = 0; markdownIndex < self.parsers[element.name].markdownFields.length; markdownIndex += 1) | ||
{ | ||
var markdownField = self.parsers[element.name].markdownFields[markdownIndex]; | ||
if(result[markdownField]) | ||
{ | ||
result[markdownField] = markdown(result[markdownField]); | ||
// remove line breaks. | ||
result[markdownField] = result[markdownField].replace(/(\r\n|\n|\r)/g, ""); | ||
} | ||
} // for | ||
} | ||
} | ||
catch(e) | ||
{ | ||
throw new Error("\"@" + element.sourceName + "\" in file \"" + self.filename + | ||
"\" block number " + (blockIndex + 1) + " " + e | ||
); | ||
} | ||
for (var i = 0; i < indexApiBlocks.length; i += 1) { | ||
var blockIndex = indexApiBlocks[i]; | ||
var elements = detectedElements[blockIndex]; | ||
var blockData = { | ||
global: {}, | ||
local : {} | ||
}; | ||
var countAllowedMultiple = 0; | ||
if( ! result) | ||
{ | ||
throw new Error("Empty result for \"@" + element.sourceName + "\" in file \"" + self.filename + | ||
"\" block number " + (blockIndex + 1) + "." | ||
); | ||
} | ||
for (var j = 0; j < elements.length; j += 1) { | ||
var element = elements[j]; | ||
var elementParser = self.parsers[element.name]; | ||
// Check if it is allowed to add to global namespace. | ||
if(self.parsers[element.name].preventGlobal && self.parsers[element.name].preventGlobal === true) | ||
{ | ||
preventGlobal = true; | ||
// Check if count global namespace entries > count allowed | ||
// (e.g. @successTitle is global, but should co-exist with @apiErrorStructure) | ||
if(Object.keys(blockData.global).length > countAllowedMultiple) | ||
{ | ||
throw new Error("Can't set \"@" + element.sourceName + "\" in file \"" + self.filename + | ||
"\" block number " + (blockIndex + 1) + ", only one definition or use is allowed in the same block." | ||
); | ||
} | ||
} | ||
if(self.parsers[element.name].pushTo) | ||
{ | ||
// Fieldvalues will be inserted into subpath | ||
var pushTo = self.parsers[element.name].pushTo(); | ||
if ( ! elementParser) { | ||
app.log.warning('parser plugin \'' + element.name + '\' not found.'); | ||
break; | ||
} | ||
// Only one global allowed per block | ||
if(pushTo === "global" || pushTo.substr(0, 7) === "global.") | ||
{ | ||
var allowMultiple = self.parsers[element.name].allowMultiple || false; | ||
app.log.debug('found @' + element.sourceName + ', in block: ' + i); | ||
if(allowMultiple) | ||
{ | ||
countAllowedMultiple += 1; | ||
} | ||
else | ||
{ | ||
if(Object.keys(blockData.global).length > 0) | ||
{ | ||
throw new Error("Can't set \"@" + element.sourceName + "\" in file \"" + self.filename + | ||
"\" block number " + (blockIndex + 1) + ", only one definition per block allowed." | ||
); | ||
} | ||
// Deprecation hint | ||
if (elementParser.deprecated) { | ||
self.countDeprecated[element.sourceName] = self.countDeprecated[element.sourceName] ? self.countDeprecated[element.sourceName] + 1 : 1; | ||
// show deprecated message only 1 time, if verbose is set, show it every time | ||
if (app.options.verbose || self.countDeprecated[element.sourceName] === 1) | ||
if (elementParser.alternative) | ||
app.log.warning('@' + element.sourceName + ' is deprecated, please use ' + elementParser.alternative); | ||
else | ||
app.log.warning('@' + element.sourceName + ' is deprecated'); | ||
} | ||
if(preventGlobal === true) | ||
{ | ||
throw new Error("Can't set \"@" + element.sourceName + "\" in file \"" + self.filename + | ||
"\" block number " + (blockIndex + 1) + ", only one definition or use is allowed in the same block." | ||
); | ||
} | ||
} | ||
} | ||
var values; | ||
var preventGlobal; | ||
var allowMultiple; | ||
var pathTo; | ||
var attachMethod; | ||
try { | ||
// parse element and retrieve values | ||
values = elementParser.parse(element.content, element.source); | ||
if( ! blockData[pushTo]) | ||
{ | ||
// Create path | ||
self._createObjectPath(blockData, pushTo); | ||
} | ||
// HINT: pathTo MUST be read after elementParser.parse, because of dynamic paths | ||
// Add all other options after parse too, in case of a custom plugin need to modify params. | ||
var blockDataPath = _pathToObject(pushTo, blockData); | ||
// check if it is allowed to add to global namespace | ||
preventGlobal = elementParser.preventGlobal === true; | ||
// Insert Fieldvalues in Path-Array | ||
if(typeof(blockData[pushTo]) === "object") | ||
{ | ||
_.extend(blockData[pushTo], result); | ||
} | ||
else | ||
{ | ||
blockDataPath.push(result); | ||
} | ||
// allow multiple inserts into pathTo | ||
allowMultiple = elementParser.allowMultiple === true; | ||
if(self.parsers[element.name].extendRoot === true) | ||
{ | ||
// Insert Fieldvalues in Mainpath | ||
_.extend(blockData, result); | ||
} | ||
} | ||
else | ||
{ | ||
// Insert Fieldvalues in Mainpath | ||
_.extend(blockData, result); | ||
} | ||
blockData.index = blockIndex + 1; | ||
} | ||
else | ||
{ | ||
app.logWarn("parser plugin \"" + element.name + "\" not found."); | ||
} | ||
} // for | ||
parsedBlocks.push(blockData); | ||
} // for | ||
return parsedBlocks; | ||
// path to an array, where the values should be attached | ||
pathTo = ''; | ||
if (elementParser.path) { | ||
if (typeof elementParser.path === 'string') | ||
pathTo = elementParser.path; | ||
else | ||
pathTo = elementParser.path(); // for dynamic paths | ||
} | ||
if ( ! pathTo) | ||
throw new ParserError('pathTo is not defined in the parser file.', '', '', element.sourceName); | ||
// method how the values should be attached (insert or push) | ||
attachMethod = elementParser.method || 'push'; | ||
if (attachMethod !== 'insert' && attachMethod !== 'push') | ||
throw new ParserError('Only push or insert are allowed parser method values.', '', '', element.sourceName); | ||
// Markdown | ||
// TODO: put this into converters | ||
if ( values && | ||
app.options.marked.gfm && | ||
elementParser.markdownFields && | ||
elementParser.markdownFields.length > 0 | ||
) { | ||
for (var markdownIndex = 0; markdownIndex < elementParser.markdownFields.length; markdownIndex += 1) { | ||
var markdownField = elementParser.markdownFields[markdownIndex]; | ||
if (values[markdownField]) { | ||
values[markdownField] = markdown(values[markdownField]); | ||
// remove line breaks | ||
values[markdownField] = values[markdownField].replace(/(\r\n|\n|\r)/g, ' '); | ||
} | ||
} | ||
} | ||
} catch(e) { | ||
if (e instanceof ParameterError) { | ||
var extra = []; | ||
if (e.definition) | ||
extra.push({ 'Definition': e.definition }); | ||
if (e.example) | ||
extra.push({ 'Example': e.example }); | ||
throw new ParserError(e.message, | ||
self.filename, (blockIndex + 1), element.sourceName, element.source, extra); | ||
} | ||
throw new ParserError('Undefined error.', | ||
self.filename, (blockIndex + 1), element.sourceName, element.source); | ||
} | ||
if ( ! values) | ||
throw new ParserError('Empty parser result.', | ||
self.filename, (blockIndex + 1), element.sourceName, element.source); | ||
if (preventGlobal) { | ||
// Check if count global namespace entries > count allowed | ||
// (e.g. @successTitle is global, but should co-exist with @apiErrorStructure) | ||
if (Object.keys(blockData.global).length > countAllowedMultiple) | ||
throw new ParserError('Only one definition or usage is allowed in the same block.', | ||
self.filename, (blockIndex + 1), element.sourceName, element.source); | ||
} | ||
// only one global allowed per block | ||
if (pathTo === 'global' || pathTo.substr(0, 7) === 'global.') { | ||
if (allowMultiple) { | ||
countAllowedMultiple += 1; | ||
} else { | ||
if (Object.keys(blockData.global).length > 0) | ||
throw new ParserError('Only one definition is allowed in the same block.', | ||
self.filename, (blockIndex + 1), element.sourceName, element.source); | ||
if (preventGlobal === true) | ||
throw new ParserError('Only one definition or usage is allowed in the same block.', | ||
self.filename, (blockIndex + 1), element.sourceName, element.source); | ||
} | ||
} | ||
if ( ! blockData[pathTo]) | ||
self._createObjectPath(blockData, pathTo, attachMethod); | ||
var blockDataPath = self._pathToObject(pathTo, blockData); | ||
// insert Fieldvalues in Path-Array | ||
if (attachMethod === 'push') | ||
blockDataPath.push(values); | ||
else | ||
_.extend(blockDataPath, values); | ||
// insert Fieldvalues in Mainpath | ||
if (elementParser.extendRoot === true) | ||
_.extend(blockData, values); | ||
blockData.index = blockIndex + 1; | ||
} | ||
parsedBlocks.push(blockData); | ||
} | ||
return parsedBlocks; | ||
}; | ||
/** | ||
* Return Path to Object. | ||
*/ | ||
function _pathToObject(path, src) { | ||
if( ! path) return src; | ||
var pathParts = path.split("."); | ||
var current = src; | ||
for(var i = 0; i < pathParts.length; i += 1) | ||
{ | ||
var part = pathParts[i]; | ||
current = current[part]; | ||
} // for | ||
return current; | ||
} // _pathToObject | ||
/** | ||
* Create a not existing Path in an Object. | ||
* Create a not existing Path in an Object | ||
* | ||
* @param src | ||
* @param path | ||
* @param {String} attachMethod Create last element as object or array: 'insert', 'push' | ||
* @returns {Object} | ||
*/ | ||
Parser.prototype._createObjectPath = function(src, path) | ||
{ | ||
if( ! path) return src; | ||
var pathParts = path.split("."); | ||
var current = src; | ||
for(var i = 0; i < pathParts.length; i += 1) | ||
{ | ||
var part = pathParts[i]; | ||
if( ! current[part]) | ||
{ | ||
if(i === (pathParts.length - 1) ) current[part] = []; | ||
else current[part] = {}; | ||
} | ||
current = current[part]; | ||
} // for | ||
return current; | ||
}; // _createObjectPath | ||
Parser.prototype._createObjectPath = function(src, path, attachMethod) { | ||
if ( ! path) | ||
return src; | ||
var pathParts = path.split('.'); | ||
var current = src; | ||
for (var i = 0; i < pathParts.length; i += 1) { | ||
var part = pathParts[i]; | ||
if ( ! current[part]) { | ||
if (i === (pathParts.length - 1) && attachMethod === 'push' ) | ||
current[part] = []; | ||
else | ||
current[part] = {}; | ||
} | ||
current = current[part]; | ||
} | ||
return current; | ||
}; | ||
/** | ||
* Return Path to Object | ||
*/ | ||
Parser.prototype._pathToObject = function(path, src) { | ||
if ( ! path) | ||
return src; | ||
var pathParts = path.split('.'); | ||
var current = src; | ||
for (var i = 0; i < pathParts.length; i += 1) { | ||
var part = pathParts[i]; | ||
current = current[part]; | ||
} | ||
return current; | ||
}; | ||
/** | ||
* Determine Blocks | ||
*/ | ||
Parser.prototype._findBlocks = function() | ||
{ | ||
Parser.prototype._findBlocks = function() { | ||
var self = this; | ||
@@ -319,54 +338,53 @@ var blocks = []; | ||
// Replace Linebreak with Unicode | ||
src = src.replace(/\n/g, "\uffff"); | ||
src = src.replace(/\n/g, '\uffff'); | ||
var regexs = { | ||
".coffee": { | ||
// Find document blocks between "###" and "###" | ||
'.coffee': { | ||
// Find document blocks between '###' and '###' | ||
docBlocksRegExp: /###\uffff?(.+?)###/g, | ||
// Remove not needed " " (tabs) at the beginning | ||
inlineRegExp: /^(\t+)?[ ]?/gm | ||
// Remove not needed ' ' (tabs) at the beginning | ||
inlineRegExp: /^(\s*)?[ ]?/gm | ||
}, | ||
".erl": { | ||
// Find document blocks between "%{" and "%}" | ||
docBlocksRegExp: /\%\{\uffff?(.+?)\%\}/g, | ||
// Remove not needed " % " and " " (tabs) at the beginning | ||
'.erl': { | ||
// Find document blocks between '%{' and '%}' | ||
docBlocksRegExp: /\%*\{\uffff?(.+?)\%+\}/g, | ||
// Remove not needed ' % ' and ' ' (tabs) at the beginning | ||
// HINT: Not sure if erlang developer use the %, but i think it should be no problem | ||
inlineRegExp: /^(\t+)?(\%)[ ]?/gm | ||
inlineRegExp: /^(\s*)?(\%*)[ ]?/gm | ||
}, | ||
".py": { | ||
// Find document blocks between """ and """ | ||
docBlocksRegExp: /\"\"\"\uffff?(.+?)\"\"\"/g, | ||
// Remove not needed " " (tabs) at the beginning | ||
inlineRegExp: /^(\t+)?[ ]?/gm | ||
'.py': { | ||
// Find document blocks between ''' and ''' | ||
docBlocksRegExp: /\'\'\'\uffff?(.+?)\'\'\'/g, | ||
// Remove not needed ' ' (tabs) at the beginning | ||
inlineRegExp: /^(\s*)?[ ]?/gm | ||
}, | ||
".rb": { | ||
// Find document blocks between "=begin" and "=end" | ||
'.rb': { | ||
// Find document blocks between '=begin' and '=end' | ||
docBlocksRegExp: /\=begin\uffff?(.+?)\=end/g, | ||
// Remove not needed " " (tabs) at the beginning | ||
inlineRegExp: /^(\t+)?[ ]?/gm | ||
// Remove not needed ' ' (tabs) at the beginning | ||
inlineRegExp: /^(\s*)?[ ]?/gm | ||
}, | ||
".pm": { | ||
// Find document blocks between "#**" and "#*" | ||
// or between "=pod" and "=cut" | ||
'.pm': { | ||
// Find document blocks between '#**' and '#*' | ||
// or between '=pod' and '=cut' | ||
docBlocksRegExp: /#\*\*\uffff?(.+?)#\*|=pod\uffff?(.+?)=cut/g, | ||
// Remove not needed " # " and " " (tabs) at the beginning | ||
inlineRegExp: /^(\s+)?(#)[ ]?/gm | ||
// Remove not needed ' # ' and ' ' (tabs) at the beginning | ||
inlineRegExp: /^(\s*)?(#)[ ]?/gm | ||
}, | ||
"default": { | ||
// Find document blocks between "#**" and "#*" | ||
'default': { | ||
// Find document blocks between '#**' and '#*' | ||
docBlocksRegExp: /\/\*\*\uffff?(.+?)\*\//g, | ||
// Remove not needed " # " and " " (tabs) at the beginning | ||
inlineRegExp: /^(\s+)?(\*)[ ]?/gm | ||
// Remove not needed ' * ' and ' ' (tabs) at the beginning | ||
inlineRegExp: /^(\s*)?(\*)[ ]?/gm | ||
} | ||
}; | ||
var regexForFile = regexs[self.extension] || regexs["default"]; | ||
var regexForFile = regexs[self.extension] || regexs['default']; | ||
var matches = regexForFile.docBlocksRegExp.exec(src); | ||
while(matches) | ||
{ | ||
while (matches) { | ||
var block = matches[2] || matches[1]; | ||
// Reverse Unicode Linebreaks | ||
block = block.replace(/\uffff/g, "\n"); | ||
block = block.replace(/\uffff/g, '\n'); | ||
block = block.replace(regexForFile.inlineRegExp, ""); | ||
block = block.replace(regexForFile.inlineRegExp, ''); | ||
@@ -377,63 +395,65 @@ blocks.push(block); | ||
matches = regexForFile.docBlocksRegExp.exec(src); | ||
} // while | ||
} | ||
return blocks; | ||
}; | ||
}; // _findBlocks | ||
/** | ||
* Check if block has API elements and return block indexes. | ||
* Return block indexes with active API-elements | ||
* | ||
* An @apiIgnore ignores the block. | ||
* Other, non @api elements, will be ignored. | ||
*/ | ||
Parser.prototype._findBlockWithApiGetIndex = function(blocks) | ||
{ | ||
Parser.prototype._findBlockWithApiGetIndex = function(blocks) { | ||
var foundIndexes = []; | ||
blocks.forEach(function(block, i){ | ||
var add; | ||
block.forEach(function(element) | ||
{ | ||
if(add !== false){ | ||
add = element.name.substr(0, 3) === "api" && element.name.substr(0, 9) !== "apiignore"; | ||
for (var i = 0; i < blocks.length; i += 1) { | ||
var found = false; | ||
for (var j = 0; j < blocks[i].length; j += 1) { | ||
if (blocks[i][j].name.substr(0, 9) === 'apiignore') { | ||
app.log.debug('apiIgnore found in block: ' + i); | ||
found = false; | ||
break; | ||
} | ||
}); | ||
if(add) | ||
{ | ||
if (blocks[i][j].name.substr(0, 3) === 'api') | ||
found = true; | ||
} | ||
if (found) { | ||
foundIndexes.push(i); | ||
app.debug("api found in block: " + i); | ||
app.log.debug('api found in block: ' + i); | ||
} | ||
}); | ||
} | ||
return foundIndexes; | ||
}; // _findBlockWithApiGetIndex | ||
}; | ||
/** | ||
* Get Elements of Blocks. | ||
* Get Elements of Blocks | ||
*/ | ||
Parser.prototype._findElements = function(block) | ||
{ | ||
var self = this; | ||
var elements = []; | ||
Parser.prototype._findElements = function(block) { | ||
var self = this; | ||
var elements = []; | ||
// Replace Linebreak with Unicode | ||
block = block.replace(/\n/g, "\uffff"); | ||
// Replace Linebreak with Unicode | ||
block = block.replace(/\n/g, '\uffff'); | ||
// Elements start with @ | ||
var elementsRegExp = /(@(\w*)\s?(.+?)(?=\uffff[\s\*]*@|$))/gm; | ||
var matches = elementsRegExp.exec(block); | ||
while(matches) | ||
{ | ||
var element = { | ||
source: matches[1], | ||
name: matches[2].toLowerCase(), | ||
sourceName: matches[2], | ||
content: matches[3] | ||
}; | ||
// Elements start with @ | ||
var elementsRegExp = /(@(\w*)\s?(.+?)(?=\uffff[\s\*]*@|$))/gm; | ||
var matches = elementsRegExp.exec(block); | ||
while (matches) { | ||
var element = { | ||
source : matches[1], | ||
name : matches[2].toLowerCase(), | ||
sourceName: matches[2], | ||
content : matches[3] | ||
}; | ||
// Reverse Unicode Linebreaks | ||
element.content = element.content.replace(/\uffff/g, "\n"); | ||
element.source = element.source.replace(/\uffff/g, "\n"); | ||
// reverse Unicode Linebreaks | ||
element.content = element.content.replace(/\uffff/g, '\n'); | ||
element.source = element.source.replace(/\uffff/g, '\n'); | ||
elements.push(element); | ||
elements.push(element); | ||
// Next Match | ||
matches = elementsRegExp.exec(block); | ||
} | ||
return elements; | ||
}; // _findElements | ||
// next Match | ||
matches = elementsRegExp.exec(block); | ||
} | ||
return elements; | ||
}; |
@@ -1,23 +0,27 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
var name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiDefine | ||
var apiParser = require('./api_define.js'); | ||
if(content.length === 0) return null; | ||
return { | ||
defineErrorStructure: name | ||
}; | ||
} // parse | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiDefineErrorStructure', | ||
usage : '@apiDefineErrorStructure name', | ||
example: '@apiDefineErrorStructure MyValidErrorName' | ||
} | ||
}; | ||
function pushTo() | ||
{ | ||
return "global"; | ||
} // pushTo | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'global.defineErrorStructure', | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ], | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,23 +0,27 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
var name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiDefine | ||
var apiParser = require('./api_define.js'); | ||
if(content.length === 0) return null; | ||
return { | ||
defineHeaderStructure: name | ||
}; | ||
} // parse | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiDefineHeaderStructure', | ||
usage : '@apiDefineHeaderStructure name', | ||
example: '@apiDefineHeaderStructure MyValidHeaderName' | ||
} | ||
}; | ||
function pushTo() | ||
{ | ||
return "global"; | ||
} // pushTo | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'global.defineHeaderStructure', | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ], | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,45 +0,27 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiDefine | ||
var apiParser = require('./api_define.js'); | ||
var name = ""; | ||
var title = ""; | ||
var text = ""; | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiDefinePermission', | ||
usage : '@apiDefinePermission name', | ||
example: '@apiDefinePermission MyValidPermissionName' | ||
} | ||
}; | ||
// Search for [@apiexample title] and content | ||
var parseRegExp = /^(\w*)?\s?(.*)$/gm; | ||
var matches; | ||
if(matches = parseRegExp.exec(content)) | ||
{ | ||
name = matches[1]; | ||
title = matches[2]; | ||
} | ||
while(matches = parseRegExp.exec(content)) | ||
{ | ||
text += matches[0] + "\n"; | ||
} // while | ||
if(name.length === 0) return null; | ||
return { | ||
definePermission: { | ||
name: name, | ||
title: title, | ||
description: text | ||
} | ||
}; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "global"; | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
markdownFields: [ "description" ] | ||
}; | ||
parse : parse, | ||
path : 'global.define', | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ], | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,23 +0,27 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
var name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiDefine | ||
var apiParser = require('./api_define.js'); | ||
if(content.length === 0) return null; | ||
return { | ||
defineStructure: name | ||
}; | ||
} // parse | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiDefineStructure', | ||
usage : '@apiDefineStructure name', | ||
example: '@apiDefineStructure MyValidName' | ||
} | ||
}; | ||
function pushTo() | ||
{ | ||
return "global"; | ||
} // pushTo | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'global.defineStructure', | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ], | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,23 +0,27 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
var name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiDefine | ||
var apiParser = require('./api_define.js'); | ||
if(content.length === 0) return null; | ||
return { | ||
defineSuccessStructure: name | ||
}; | ||
} // parse | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiDefineSuccessStructure', | ||
usage : '@apiDefineSuccessStructure name', | ||
example: '@apiDefineSuccessStructure MyValidSuccessName' | ||
} | ||
}; | ||
function pushTo() | ||
{ | ||
return "global"; | ||
} // pushTo | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'global.defineSuccessStructure', | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ], | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,24 +0,21 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
function parse(content) { | ||
// trim | ||
var description = content.replace(/^\s*|\s*$/g, ''); | ||
if(content.length === 0) return null; | ||
return { | ||
description: content | ||
}; | ||
} // parse | ||
if (description.length === 0) | ||
return null; | ||
function pushTo() | ||
{ | ||
return "local"; | ||
} // pushTo | ||
return { | ||
description: description | ||
}; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
markdownFields: [ "description" ] | ||
}; | ||
parse : parse, | ||
path : 'local', | ||
method : 'insert', | ||
markdownFields: [ 'description' ] | ||
}; |
@@ -1,15 +0,11 @@ | ||
// Same as @apiexample | ||
var apiExample = require("./api_example.js"); | ||
// Same as @apiExample | ||
var apiParser = require('./api_example.js'); | ||
function pushTo() | ||
{ | ||
return "local.error.examples"; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: apiExample.parse, | ||
pushTo: pushTo | ||
}; | ||
parse : apiParser.parse, | ||
path : 'local.error.examples', | ||
method: apiParser.method | ||
}; |
@@ -1,22 +0,14 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiUse | ||
var apiParser = require('./api_use.js'); | ||
if(name.length === 0) return null; | ||
return name; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "local.errorStructure"; | ||
} // pushTo | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
preventGlobal: true | ||
}; | ||
parse : apiParser.parse, | ||
path : 'local.errorStructure', | ||
method : apiParser.method, | ||
preventGlobal: true, | ||
deprecated : true, | ||
alternative : '@apiUse' | ||
}; |
// Same as @apiParamTitle | ||
var apiParser = require("./api_param_title.js"); | ||
var apiParser = require('./api_param_title.js'); | ||
function parse(content, source) | ||
{ | ||
return apiParser.parse(content, source); | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "global.errorTitle"; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
getGroup: apiParser.getGroup, | ||
allowMultiple: true | ||
}; | ||
parse : apiParser.parse, | ||
path : 'global.errorTitle', | ||
method : apiParser.method, | ||
allowMultiple: true, | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,21 +0,20 @@ | ||
// Same as @apiparam | ||
var apiParam = require("./api_param.js"); | ||
// Same as @apiParam | ||
var apiParser = require('./api_param.js'); | ||
function parse(content, source) | ||
{ | ||
return apiParam.parse(content, source, "Error 4xx"); | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, 'Error 4xx'); | ||
} | ||
function pushTo() | ||
{ | ||
return "local.error.fields." + apiParam.getGroup(); | ||
function path() { | ||
return 'local.error.fields.' + apiParser.getGroup(); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
markdownFields: [ "description" ] | ||
}; | ||
parse : parse, | ||
path : path, | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ] | ||
}; |
@@ -1,40 +0,41 @@ | ||
function parse(content, source) | ||
{ | ||
// Trim | ||
source = source.replace(/^\s+|\s+$/g, ""); | ||
function parse(content, source) { | ||
// trim | ||
source = source.replace(/^\s*|\s*$/g, ''); | ||
var title = ""; | ||
var text = ""; | ||
var title = ''; | ||
var text = ''; | ||
var type; | ||
// Search for [@apiexample title] and content | ||
// Search for [@apiExample title] and content | ||
var parseRegExp = /^(@\w*)?\s?(?:(?:\{(.+?)\})\s*)?(.*)$/gm; | ||
var matches; | ||
var matches; | ||
while(matches = parseRegExp.exec(source)) | ||
{ | ||
if(matches[1] && matches[3]) title += matches[3]; // @apiExample and title in the same line | ||
if(matches[2]) type = matches[2]; | ||
else if(matches[3]) text += matches[3] + "\n"; | ||
if (matches[1] && matches[3]) | ||
title += matches[3]; // @apiExample and title in the same line | ||
if (matches[2]) | ||
type = matches[2]; | ||
else | ||
if( ! matches[1] && matches[3]) | ||
text += matches[3] + '\n'; | ||
} // while | ||
if(text.length === 0) return null; | ||
if (text.length === 0) | ||
return null; | ||
return { | ||
title: title, | ||
title : title, | ||
content: text, | ||
type: type || "json" | ||
type : type || 'json' | ||
}; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "local.examples"; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'local.examples', | ||
method: 'push' | ||
}; |
@@ -1,24 +0,23 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
function parse(content) { | ||
// trim | ||
var description = content.replace(/^\s*|\s*$/g, ''); | ||
if(content.length === 0) return null; | ||
return { | ||
groupDescription: content | ||
}; | ||
} // parse | ||
if (description.length === 0) | ||
return null; | ||
function pushTo() | ||
{ | ||
return "local"; | ||
} // pushTo | ||
return { | ||
groupDescription: description | ||
}; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
markdownFields: [ "groupDescription" ] | ||
}; | ||
parse : parse, | ||
path : 'local', | ||
method : 'insert', | ||
markdownFields: [ 'groupDescription' ], | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,23 +0,20 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
function parse(content) { | ||
// trim | ||
var group = content.replace(/^\s*|\s*$/g, ''); | ||
if(content.length === 0) return null; | ||
if (group.length === 0) | ||
return null; | ||
return { | ||
group: content.replace(/(\s+)/g, "_") | ||
group: group.replace(/(\s+)/g, '_') | ||
}; | ||
} // parse | ||
} | ||
function pushTo() | ||
{ | ||
return "local"; | ||
} // pushTo | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'local', | ||
method: 'insert' | ||
}; |
// Same as @apiExample | ||
var apiExample = require("./api_example.js"); | ||
var apiParser = require('./api_example.js'); | ||
function pushTo() | ||
{ | ||
return "local.header.examples"; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: apiExample.parse, | ||
pushTo: pushTo | ||
parse : apiParser.parse, | ||
path : 'local.header.examples', | ||
method: apiParser.method | ||
}; |
@@ -1,22 +0,14 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
var name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiUse | ||
var apiParser = require('./api_use.js'); | ||
if(name.length === 0) return null; | ||
return name; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "local.headerStructure"; | ||
} // pushTo | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
preventGlobal: true | ||
}; | ||
parse : apiParser.parse, | ||
path : 'local.headerStructure', | ||
method : apiParser.method, | ||
preventGlobal: true, | ||
deprecated : true, | ||
alternative : '@apiUse' | ||
}; |
// Same as @apiParamTitle | ||
var apiParser = require("./api_param_title.js"); | ||
var apiParser = require('./api_param_title.js'); | ||
function parse(content, source) | ||
{ | ||
return apiParser.parse(content, source); | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "global.headerTitle"; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
getGroup: apiParser.getGroup, | ||
allowMultiple: true | ||
parse : apiParser.parse, | ||
path : 'global.headerTitle', | ||
method : apiParser.method, | ||
allowMultiple: true, | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
// Same as @apiParam | ||
var apiParam = require("./api_param.js"); | ||
var apiParser = require('./api_param.js'); | ||
function parse(content, source) | ||
{ | ||
return apiParam.parse(content, source, "Header"); | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, 'Header'); | ||
} | ||
function pushTo() | ||
{ | ||
return "local.header.fields." + apiParam.getGroup(); | ||
function path() { | ||
return 'local.header.fields.' + apiParser.getGroup(); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
markdownFields: [ "description" ] | ||
}; | ||
parse : parse, | ||
path : path, | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ] | ||
}; |
@@ -1,23 +0,20 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
function parse(content) { | ||
// trim | ||
var name = content.replace(/^\s*|\s*$/g, ''); | ||
if(content.length === 0) return null; | ||
return { | ||
name: content.replace(/(\s+)/g, "_") | ||
}; | ||
} // parse | ||
if(name.length === 0) | ||
return null; | ||
function pushTo() | ||
{ | ||
return "local"; | ||
} // pushTo | ||
return { | ||
name: name.replace(/(\s+)/g, '_') | ||
}; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'local', | ||
method: 'insert' | ||
}; |
@@ -1,41 +0,31 @@ | ||
var group = ""; | ||
function parse(content, source) { | ||
// trim | ||
content = content.replace(/^\s*|\s*$/g, ''); | ||
function parse(content, source) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
// replace Linebreak with Unicode | ||
content = content.replace(/\n/g, '\uffff'); | ||
// Replace Linebreak with Unicode | ||
content = content.replace(/\n/g, "\uffff"); | ||
// search: group, title | ||
var parseRegExp = /^(?:\((.+?)\))\s*(.*)(^@|$)/g; | ||
var matches = parseRegExp.exec(content); | ||
// Search: group, title | ||
var parseRegExp = /^(?:\((.+?)\))\s*(.*)(^@|$)/g; | ||
var matches = parseRegExp.exec(content); | ||
if ( ! matches) | ||
return null; | ||
if( ! matches) return null; | ||
return { | ||
group: matches[1], | ||
title: matches[2] | ||
}; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "global.paramTitle"; | ||
return { | ||
group: matches[1], | ||
title: matches[2] | ||
}; | ||
} | ||
function getGroup() | ||
{ | ||
return group; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
getGroup: getGroup, | ||
allowMultiple: true | ||
}; | ||
parse : parse, | ||
path : 'global.paramTitle', | ||
method : 'push', | ||
allowMultiple: true, | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,98 +0,134 @@ | ||
var group = ""; | ||
var group = ''; | ||
function parse(content, source, defaultGroup) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
// Search: group, type, optional, fieldname, defaultValue, size, description | ||
// Example: {String{1..4}} [user.name='John Doe'] Users fullname. | ||
// | ||
// Naming convention: | ||
// b -> begin | ||
// e -> end | ||
// name -> the field value | ||
// oName -> wrapper for optional field | ||
// wName -> wrapper for field | ||
var regExp = { | ||
b: '^', // start | ||
oGroup: { // optional group: (404) | ||
b: '\\s*(?:\\(\\s*', // starting with '(', optional surrounding spaces | ||
group: '(.+?)', // 1 | ||
e: '\\s*\\)\\s*)?' // ending with ')', optional surrounding spaces | ||
}, | ||
oType: { // optional type: {string} | ||
b: '\\s*(?:\\{\\s*', // starting with '{', optional surrounding spaces | ||
type: '([a-zA-Z0-9\\.\\/\\\\\\[\\]_-]+)', // 2 | ||
oSize: { // optional size within type: {string{1..4}} | ||
b: '\\s*(?:\\{\\s*', // starting with '{', optional surrounding spaces | ||
size: '(.+?)', // 3 | ||
e: '\\s*\\}\\s*)?' // ending with '}', optional surrounding spaces | ||
}, | ||
oAllowedValues: { // optional allowed values within type: {string='abc','def'} | ||
b: '\\s*(?:=\\s*', // starting with '=', optional surrounding spaces | ||
possibleValues: '(.+?)', // 4 | ||
e: '(?=\\s*\\}\\s*))?' // ending with '}', optional surrounding spaces | ||
}, | ||
e: '\\s*\\}\\s*)?' // ending with '}', optional surrounding spaces | ||
}, | ||
wName: { | ||
b: '(\\[?\\s*', // 5 optional optional-marker | ||
name: '([a-zA-Z0-9\\.\\/\\\\_-]+)', // 6 | ||
oDefaultValue: { // optional defaultValue | ||
b: '(?:\\s*=\\s*(?:', // starting with '=', optional surrounding spaces | ||
withDoubleQuote: '"([^"]*)"', // 7 | ||
withQuote: '|\'([^\']*)\'', // 8 | ||
withoutQuote: '|(.*?)(?:\\s|\\]|$)', // 9 | ||
e: '))?' | ||
}, | ||
e: '\\s*\\]?\\s*)' | ||
}, | ||
description: '(.*)?', // 10 | ||
e: '$|@' | ||
}; | ||
// Replace Linebreak with Unicode | ||
content = content.replace(/\n/g, "\uffff"); | ||
function _objectValuesToString(obj) { | ||
var str = ''; | ||
for (var el in obj) { | ||
if (typeof obj[el] === 'string') | ||
str += obj[el]; | ||
else | ||
str += _objectValuesToString(obj[el]); | ||
} | ||
return str; | ||
} | ||
// Old-RegExp: | ||
// var parseRegExp = /^(?:(?:\((.+?)\))\s*)?(?:(?:\{(.+?)\})\s*)?(\[?(\S[a-zA-Z0-9._\-]*)(?:=['|"]?([\s.a-zA-Z0-9_\-]*)['|"]?)?\]?)\s*(.*)?(^@|$)/g; | ||
var parseRegExp = new RegExp(_objectValuesToString(regExp)); | ||
function _objectValuesToString(obj) | ||
{ | ||
var str = ""; | ||
for(var el in obj) { | ||
if(typeof obj[el] === "string") str += obj[el]; | ||
else str += _objectValuesToString(obj[el]); | ||
} // for | ||
return str; | ||
} // _objectValuesToString | ||
var allowedValuesWithDoubleQuoteRegExp = new RegExp(/\"[^\"]*[^\"]\"/g); | ||
var allowedValuesWithQuoteRegExp = new RegExp(/\'[^\']*[^\']\'/g); | ||
var allowedValuesRegExp = new RegExp(/[^,\s]+/g); | ||
// Search: group, type, field, defaultValue, optional, description | ||
// Example: {Boolean} [user.name="Default Value"] Users lastname. | ||
var regExp = { | ||
b: "^", | ||
vGroup: { | ||
b: "(?:", | ||
c: { | ||
b: "(?:\\(", | ||
group: "(.+?)", // 1 | ||
e: "\\))", | ||
}, | ||
e: "\\s*)?" | ||
}, | ||
vType: { | ||
b: "(?:", | ||
c: { | ||
b: "(?:\\{", | ||
type: "(.+?)", // 2 | ||
e: "\\})", | ||
}, | ||
e: "\\s*)?" | ||
}, | ||
vBrackets: { | ||
b: "(\\[?", // 3 | ||
fieldname: "(\\S[a-zA-Z0-9\/._\\-]*)", // 4 | ||
vDefaultValue: { | ||
b: "(?:=['|\"]?", | ||
defaultValue: "(.+?(?=['|\"|\\]]))", // 5 | ||
e: "['|\"]?)?" | ||
}, | ||
e: "\\]?)" | ||
}, | ||
oWhitespace: "\\s*", | ||
vDescription: "(.*)?", // 6 | ||
e: "(^@|$)" | ||
}; | ||
var parseRegExp = new RegExp(_objectValuesToString(regExp)); | ||
var matches = parseRegExp.exec(content); | ||
function parse(content, source, defaultGroup) { | ||
// trim | ||
content = content.replace(/^\s*|\s*$/g, ''); | ||
if( ! matches) return null; | ||
// replace Linebreak with Unicode | ||
content = content.replace(/\n/g, '\uffff'); | ||
// Reverse Unicode Linebreaks | ||
if(matches[6]) matches[6] = matches[6].replace(/\uffff/g, "\n"); | ||
var matches = parseRegExp.exec(content); | ||
group = matches[1] || defaultGroup || "Parameter"; | ||
if ( ! matches) | ||
return null; | ||
return { | ||
group: group, | ||
type: matches[2], | ||
field: matches[4], | ||
defaultValue: matches[5], | ||
optional: (matches[3] !== matches[4]) ? true : false, | ||
description: matches[6] || "" | ||
}; | ||
} // parse | ||
var allowedValues = matches[4]; | ||
if (allowedValues) { | ||
var regExp; | ||
if (allowedValues.charAt(0) === '"') | ||
regExp = allowedValuesWithDoubleQuoteRegExp; | ||
else if (allowedValues.charAt(0) === '\'') | ||
regExp = allowedValuesWithQuoteRegExp; | ||
else | ||
regExp = allowedValuesRegExp; | ||
function pushTo() | ||
{ | ||
return "local.parameter.fields." + getGroup(); | ||
var allowedValuesMatch; | ||
var list = []; | ||
while (allowedValuesMatch = regExp.exec(allowedValues)) { | ||
list.push(allowedValuesMatch[0]); | ||
} | ||
allowedValues = list; | ||
} | ||
// Replace Unicode Linebreaks in description | ||
if (matches[10]) | ||
matches[10] = matches[10].replace(/\uffff/g, '\n'); | ||
// Set global group variable | ||
group = matches[1] || defaultGroup || 'Parameter'; | ||
return { | ||
group : group, | ||
type : matches[2], | ||
size : matches[3], | ||
allowedValues: allowedValues, | ||
optional : (matches[5] && matches[5][0] === '[') ? true : false, | ||
field : matches[6], | ||
defaultValue : matches[7] || matches[8] || matches[9], | ||
description : matches[10] || '' | ||
}; | ||
} | ||
function getGroup() | ||
{ | ||
return group; | ||
function path() { | ||
return 'local.parameter.fields.' + getGroup(); | ||
} | ||
function getGroup() { | ||
return group; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
getGroup: getGroup, | ||
markdownFields: [ "description" ] | ||
}; | ||
parse : parse, | ||
path : path, | ||
method : 'push', | ||
getGroup : getGroup, | ||
markdownFields: [ 'description' ] | ||
}; |
@@ -1,23 +0,14 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiUse | ||
var apiParser = require('./api_use.js'); | ||
if(content.length === 0) return null; | ||
return { | ||
permission: content | ||
}; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "local"; | ||
} // pushTo | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : apiParser.parse, | ||
path : 'local.permission', | ||
method : apiParser.method, | ||
preventGlobal: true, | ||
deprecated : true, | ||
alternative : '@apiUse' | ||
}; |
@@ -1,24 +0,20 @@ | ||
function parse(content, source) | ||
{ | ||
// Trim | ||
var url = content.replace(/^\s+|\s+$/g, ""); | ||
if(url.length === 0) return null; | ||
function parse(content, source) { | ||
// trim | ||
var url = content.replace(/^\s*|\s*$/g, ''); | ||
return { | ||
url: url | ||
}; | ||
} // parse | ||
if(url.length === 0) | ||
return null; | ||
function pushTo() | ||
{ | ||
return "local.sampleRequest"; | ||
return { | ||
url: url | ||
}; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'local.sampleRequest', | ||
method: 'push' | ||
}; |
@@ -1,22 +0,14 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
var name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiUse | ||
var apiParser = require('./api_use.js'); | ||
if(name.length === 0) return null; | ||
return name; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "local.structure"; | ||
} // pushTo | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
preventGlobal: true | ||
}; | ||
parse : apiParser.parse, | ||
path : 'local.structure', | ||
method : apiParser.method, | ||
preventGlobal: true, | ||
deprecated : true, | ||
alternative : '@apiUse' | ||
}; |
@@ -1,15 +0,11 @@ | ||
// Same as @apiexample | ||
var apiExample = require("./api_example.js"); | ||
// Same as @apiExample | ||
var apiParser = require('./api_example.js'); | ||
function pushTo() | ||
{ | ||
return "local.success.examples"; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: apiExample.parse, | ||
pushTo: pushTo | ||
}; | ||
parse : apiParser.parse, | ||
path : 'local.success.examples', | ||
method: apiParser.method | ||
}; |
@@ -1,22 +0,14 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
name = content.replace(/^\s+|\s+$/g, ""); | ||
// Same as @apiUse | ||
var apiParser = require('./api_use.js'); | ||
if(name.length === 0) return null; | ||
return name; | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "local.successStructure"; | ||
} // pushTo | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
preventGlobal: true | ||
}; | ||
parse : apiParser.parse, | ||
path : 'local.successStructure', | ||
method : apiParser.method, | ||
preventGlobal: true, | ||
deprecated : true, | ||
alternative : '@apiUse' | ||
}; |
// Same as @apiParamTitle | ||
var apiParser = require("./api_param_title.js"); | ||
var apiParser = require('./api_param_title.js'); | ||
function parse(content, source) | ||
{ | ||
return apiParser.parse(content, source); | ||
} // parse | ||
function pushTo() | ||
{ | ||
return "global.successTitle"; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
getGroup: apiParser.getGroup, | ||
allowMultiple: true | ||
}; | ||
parse : apiParser.parse, | ||
path : 'global.successTitle', | ||
method : apiParser.method, | ||
allowMultiple: true, | ||
deprecated : true, | ||
alternative : '@apiDefine' | ||
}; |
@@ -1,21 +0,20 @@ | ||
// Same as @apiparam | ||
var apiParam = require("./api_param.js"); | ||
// Same as @apiParam | ||
var apiParser = require('./api_param.js'); | ||
function parse(content, source) | ||
{ | ||
return apiParam.parse(content, source, "Success 200"); | ||
function parse(content, source) { | ||
return apiParser.parse(content, source, 'Success 200'); | ||
} | ||
function pushTo() | ||
{ | ||
return "local.success.fields." + apiParam.getGroup(); | ||
function path() { | ||
return 'local.success.fields.' + apiParser.getGroup(); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
markdownFields: [ "description" ] | ||
}; | ||
parse : parse, | ||
path : path, | ||
method : apiParser.method, | ||
markdownFields: [ 'description' ] | ||
}; |
@@ -1,29 +0,32 @@ | ||
var semver = require("semver"); | ||
var semver = require('semver'); | ||
var ParameterError = require('../errors/parameter_error'); | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
function parse(content) { | ||
// trim | ||
content = content.replace(/^\s*|\s*$/g, ''); | ||
if(content.length === 0) return null; | ||
if (content.length === 0) | ||
return null; | ||
if( ! semver.valid(content)) throw "version \"" + content + "\" not valid."; | ||
if ( ! semver.valid(content)) | ||
throw new ParameterError('Version format not valid.', | ||
'apiVersion', '@apiVersion major.minor.patch', '@apiDefine 1.2.3'); | ||
return { | ||
version: content | ||
}; | ||
} // parse | ||
return { | ||
version: content | ||
}; | ||
} | ||
function pushTo() | ||
{ | ||
return "local"; | ||
} // pushTo | ||
function pushTo() { | ||
return 'local'; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo, | ||
extendRoot: true | ||
}; | ||
parse : parse, | ||
path : 'local', | ||
method : 'insert', | ||
extendRoot: true | ||
}; |
@@ -1,30 +0,27 @@ | ||
function parse(content) | ||
{ | ||
// Trim | ||
content = content.replace(/^\s+|\s+$/g, ""); | ||
function parse(content) { | ||
// trim | ||
content = content.replace(/^\s*|\s*$/g, ''); | ||
// Search: type, url and title | ||
// Example: {get} /user/:id Get User by ID. | ||
var parseRegExp = /^(?:(?:\{(.+?)\})?\s)?(.+?)(?:\s(.+?))?$/g; | ||
var matches = parseRegExp.exec(content); | ||
// Search: type, url and title | ||
// Example: {get} /user/:id Get User by ID. | ||
var parseRegExp = /^(?:(?:\{(.+?)\})?\s*)?(.+?)(?:\s+(.+?))?$/g; | ||
var matches = parseRegExp.exec(content); | ||
if( ! matches) return null; | ||
return { | ||
type: matches[1], | ||
url: matches[2], | ||
title: matches[3] || "" | ||
}; | ||
} // parse | ||
if ( ! matches) | ||
return null; | ||
function pushTo() | ||
{ | ||
return "local"; | ||
} // pushTo | ||
return { | ||
type : matches[1], | ||
url : matches[2], | ||
title: matches[3] || '' | ||
}; | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
parse: parse, | ||
pushTo: pushTo | ||
}; | ||
parse : parse, | ||
path : 'local', | ||
method: 'insert' | ||
}; |
@@ -1,92 +0,124 @@ | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var wrench = require("wrench"); | ||
var os = require("os"); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var wrench = require('wrench'); | ||
var os = require('os'); | ||
var FileError = require('../errors/file_error'); | ||
/** | ||
* Search files recursivly and filter by include / exlude filters. | ||
* Search files recursivly and filter with include / exlude filters | ||
*/ | ||
function FindFiles() { | ||
this.path = './'; | ||
this.excludeFilters = []; | ||
this.includeFilters = []; | ||
} | ||
/** | ||
* Exports | ||
*/ | ||
module.exports = new FindFiles(); | ||
/** | ||
* Set path to source-files | ||
* | ||
* @param {Object[]} options Options. | ||
* @param {String} options.src Path to source-files. | ||
* @param {String[]} [options.excludeFilters] Exclude Filters. | ||
* @param {String[]} options.includeFilters Include Filters. | ||
* @param {String} path | ||
*/ | ||
FindFiles.prototype.setPath = function(path) { | ||
if (path) | ||
this.path = path; | ||
}; | ||
/** | ||
* Set exclude filters | ||
* | ||
* @param {string[]} excludeFilters | ||
*/ | ||
FindFiles.prototype.setExcludeFilters = function(excludeFilters) { | ||
if (excludeFilters) | ||
this.excludeFilters = excludeFilters; | ||
}; | ||
/** | ||
* Set include filters | ||
* | ||
* @param {string[]} isSilent | ||
*/ | ||
FindFiles.prototype.setIncludeFilters = function(includeFilters) { | ||
if (includeFilters) | ||
this.includeFilters = includeFilters; | ||
}; | ||
/** | ||
* Search files recursivly and filter by include / exlude filters | ||
* | ||
* @returns {String[]} | ||
*/ | ||
function findFiles(options) | ||
{ | ||
var files = []; | ||
try { | ||
// Find Files | ||
files = wrench.readdirSyncRecursive(options.src); | ||
FindFiles.prototype.search = function() { | ||
var self = this; | ||
var files = []; | ||
try { | ||
// find Files | ||
files = wrench.readdirSyncRecursive(self.path); | ||
// Create RegExp Include Filter List | ||
var regExpIncludeFilters = []; | ||
filters = options.includeFilters; | ||
if(typeof(filters) === "string") filters = [ filters ]; | ||
filters.forEach(function(filter) { | ||
if(filter.length > 0) { | ||
regExpIncludeFilters.push( new RegExp(filter) ); | ||
} | ||
}); // forEach | ||
// create RegExp Include Filter List | ||
var regExpIncludeFilters = []; | ||
filters = self.includeFilters; | ||
if (typeof(filters) === 'string') | ||
filters = [ filters ]; | ||
// RegExp Include Filter | ||
var length = regExpIncludeFilters.length; | ||
files = files.filter(function(filename) { | ||
// Not include Directories like "dirname.js" | ||
var fullFilename = path.join(options.src, filename); | ||
if(fs.statSync(fullFilename).isDirectory()) return 0; | ||
filters.forEach(function(filter) { | ||
if (filter.length > 0) | ||
regExpIncludeFilters.push( new RegExp(filter) ); | ||
}); | ||
if(os.platform() === "win32") { | ||
filename = filename.replace(/\\/g, "/"); | ||
} | ||
// RegExp Include Filter | ||
var length = regExpIncludeFilters.length; | ||
files = files.filter(function(filename) { | ||
// Not include Directories like 'dirname.js' | ||
var fullFilename = path.join(self.path, filename); | ||
if (fs.statSync(fullFilename).isDirectory()) | ||
return 0; | ||
// Apply every filter | ||
for(var i = 0; i < length; i += 1) | ||
{ | ||
if(regExpIncludeFilters[i].test(filename)) return 1; | ||
} // for | ||
return 0; | ||
}); // files.filter | ||
if (os.platform() === 'win32') | ||
filename = filename.replace(/\\/g, '/'); | ||
// Create RegExp Exclude Filter List | ||
var regExpExcludeFilters = []; | ||
filters = options.excludeFilters; | ||
if(typeof(filters) === "string") filters = [ filters ]; | ||
filters.forEach(function(filter) { | ||
if(filter.length > 0) regExpExcludeFilters.push( new RegExp(filter) ); | ||
}); // forEach | ||
// apply every filter | ||
for (var i = 0; i < length; i += 1) { | ||
if(regExpIncludeFilters[i].test(filename)) | ||
return 1; | ||
} | ||
return 0; | ||
}); | ||
// RegExp Exclude Filter | ||
length = regExpExcludeFilters.length; | ||
files = files.filter(function(filename) { | ||
// create RegExp Exclude Filter List | ||
var regExpExcludeFilters = []; | ||
filters = self.excludeFilters; | ||
if (typeof(filters) === 'string') | ||
filters = [ filters ]; | ||
if(os.platform() === "win32") { | ||
filename = filename.replace(/\\/g, "/"); | ||
} | ||
filters.forEach(function(filter) { | ||
if (filter.length > 0) | ||
regExpExcludeFilters.push( new RegExp(filter) ); | ||
}); // forEach | ||
// Apply every filter | ||
for(var i = 0; i < length; i += 1) | ||
{ | ||
if(regExpExcludeFilters[i].test(filename)) return 0; | ||
} // for | ||
return 1; | ||
}); // files.filter | ||
} // try | ||
catch (e) { | ||
console.warn(e); | ||
} // catch | ||
finally | ||
{ | ||
if( ! files || files.length === 0) | ||
{ | ||
console.log("apidoc: no files found in " + options.src); | ||
process.exit(0); | ||
} | ||
} // finally | ||
return files; | ||
} // findFiles | ||
// RegExp Exclude Filter | ||
length = regExpExcludeFilters.length; | ||
files = files.filter(function(filename) { | ||
if (os.platform() === 'win32') | ||
filename = filename.replace(/\\/g, '/'); | ||
/** | ||
* Exports | ||
*/ | ||
module.exports = findFiles; | ||
// apply every filter | ||
for(var i = 0; i < length; i += 1) { | ||
if(regExpExcludeFilters[i].test(filename)) | ||
return 0; | ||
} | ||
return 1; | ||
}); | ||
} catch (e) { | ||
throw e; | ||
} finally { | ||
if ( ! files || files.length === 0) | ||
throw new FileError('No files found.', self.path); | ||
} | ||
return files; | ||
}; |
@@ -1,24 +0,34 @@ | ||
var util = require("util"); | ||
var _ = require("underscore"); | ||
var util = require('util'); | ||
var _ = require('lodash'); | ||
var app = {}; | ||
function Worker(_app) | ||
{ | ||
var self = this; | ||
/** | ||
* Worker | ||
* | ||
* Attaches defined data to parameter which inherit the data. | ||
* It uses 2 functions, preProcess and postProcess (with the result of preProcess). | ||
* | ||
* preProcess Generates a list with [defineName][name][version] = value | ||
* postProcess Attach the preProcess data with the nearest version to the tree. | ||
* | ||
* @param {Object} _app | ||
*/ | ||
function Worker(_app) { | ||
var self = this; | ||
// Global Variables | ||
app = _app; | ||
// global variables | ||
app = _app; | ||
// Class Variables | ||
this.workers = []; | ||
// class variables | ||
this.workers = {}; | ||
// Load Worker | ||
var workers = Object.keys(app.workers); | ||
workers.forEach(function(worker) { | ||
var filename = app.workers[worker]; | ||
app.debug("load worker: " + worker + ", " + filename); | ||
self.addWorker(worker, require(filename)); | ||
}); | ||
} // Worker | ||
// load worker | ||
var workers = Object.keys(app.workers); | ||
workers.forEach(function(worker) { | ||
var filename = app.workers[worker]; | ||
app.log.debug('load worker: ' + worker + ', ' + filename); | ||
self.addWorker(worker, require(filename)); | ||
}); | ||
} | ||
@@ -38,16 +48,42 @@ /** | ||
*/ | ||
Worker.prototype.addWorker = function(name, worker) | ||
{ | ||
this.workers.push(worker); | ||
}; // addWorker | ||
Worker.prototype.addWorker = function(name, worker) { | ||
this.workers[name] = worker; | ||
}; | ||
/** | ||
* Execute worker | ||
* | ||
* @todo Add priority system (if needed), if a plugin need an other operation to be done before. | ||
*/ | ||
Worker.prototype.process = function(parsedFiles, parsedFilenames, packageInfos) | ||
{ | ||
Worker.prototype.process = function(parsedFiles, parsedFilenames, packageInfos) { | ||
// some smaller operation that are not outsourced to extra workers | ||
// TODO: add priority system first and outsource them then | ||
parsedFiles.forEach(function(parsedFile, fileIndex) { | ||
parsedFile.forEach(function(block) { | ||
if (Object.keys(block.global).length === 0 && Object.keys(block.local).length > 0) { | ||
if ( ! block.local.type) | ||
block.local.type = ''; | ||
if ( ! block.local.url) | ||
block.local.url = ''; | ||
if ( ! block.local.version) | ||
block.local.version = '0.0.0'; | ||
if ( ! block.local.filename) | ||
block.local.filename = parsedFilenames[fileIndex]; | ||
// convert dir delimeter \\ to / | ||
block.local.filename = block.local.filename.replace(/\\/g, '/'); | ||
} | ||
}); | ||
}); | ||
// process transformations and assignments for each @api-Parameter | ||
var preProcessResults = {}; | ||
this.workers.forEach(function(worker){ | ||
if(worker.preProcess) | ||
{ | ||
_.each(this.workers, function(worker, name) { | ||
if (worker.preProcess) { | ||
app.log.info('worker preProcess: ' + name); | ||
var result = worker.preProcess(parsedFiles, parsedFilenames, packageInfos); | ||
@@ -57,16 +93,8 @@ _.extend(preProcessResults, result); | ||
}); | ||
this.workers.forEach(function(worker){ | ||
if(worker.postProcess) | ||
{ | ||
try | ||
{ | ||
worker.postProcess(parsedFiles, parsedFilenames, preProcessResults, packageInfos); | ||
} | ||
catch(e) | ||
{ | ||
throw e; | ||
} | ||
_.each(this.workers, function(worker, name) { | ||
if (worker.postProcess) { | ||
app.log.info('worker postProcess: ' + name); | ||
worker.postProcess(parsedFiles, parsedFilenames, preProcessResults, packageInfos); | ||
} | ||
}); | ||
}; // process | ||
}; |
@@ -1,35 +0,43 @@ | ||
var apiWorker = require("./api_structure.js"); | ||
// Same as @apiUse | ||
var apiWorker = require('./api_use.js'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiErrorStructure', | ||
usage : '@apiErrorStructure group', | ||
example: '@apiDefine MyValidErrorStructureGroup Some title\n@apiErrorStructure MyValidErrorStructureGroup' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {Object} packageInfos | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos) | ||
{ | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, "errorStructure", "defineErrorStructure"); | ||
} // preProcess | ||
function preProcess(parsedFiles, filenames, packageInfos) { | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, 'defineErrorStructure'); | ||
} | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos) | ||
{ | ||
apiWorker.postProcess(parsedFiles, filenames, preProcessResults, packageInfos, "errorStructure", "defineErrorStructure"); | ||
} // postProcess | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
apiWorker.postProcess(parsedFiles, filenames, preProcess, packageInfos, 'defineErrorStructure', 'errorStructure', _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
}; | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
@@ -1,35 +0,43 @@ | ||
var apiWorker = require("./api_param_title.js"); | ||
// Same as @apiParamTitle | ||
var apiWorker = require('./api_param_title.js'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiError', | ||
usage : '@apiError (group) varname', | ||
example: '@apiDefine MyValidErrorGroup Some title or 40X Error\n@apiError (MyValidErrorGroup) username' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {Object} packageInfos | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos) | ||
{ | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, "errorTitle"); | ||
} // preProcess | ||
function preProcess(parsedFiles, filenames, packageInfos) { | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, 'defineErrorTitle'); | ||
} | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos) | ||
{ | ||
apiWorker.postProcess(parsedFiles, filenames, preProcessResults, packageInfos, "error", "errorTitle"); | ||
} // postProcess | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
apiWorker.postProcess(parsedFiles, filenames, preProcess, packageInfos, 'defineErrorTitle', 'error', _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
}; | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
@@ -1,35 +0,43 @@ | ||
var apiWorker = require("./api_structure.js"); | ||
// Same as @apiUse | ||
var apiWorker = require('./api_use.js'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiHeaderStructure', | ||
usage : '@apiHeaderStructure group', | ||
example: '@apiDefine MyValidHeaderStructureGroup Some title\n@apiHeaderStructure MyValidHeaderStructureGroup' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {Object} packageInfos | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos) | ||
{ | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, "headerStructure", "defineHeaderStructure"); | ||
} // preProcess | ||
function preProcess(parsedFiles, filenames, packageInfos) { | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, 'defineHeaderStructure'); | ||
} | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos) | ||
{ | ||
apiWorker.postProcess(parsedFiles, filenames, preProcessResults, packageInfos, "headerStructure", "defineHeaderStructure"); | ||
} // postProcess | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
apiWorker.postProcess(parsedFiles, filenames, preProcess, packageInfos, 'defineHeaderStructure', 'headerStructure', _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
}; | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
@@ -1,35 +0,43 @@ | ||
var apiWorker = require("./api_param_title.js"); | ||
// Same as @apiParamTitle | ||
var apiWorker = require('./api_param_title.js'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiHeader', | ||
usage : '@apiHeader (group) varname', | ||
example: '@apiDefine MyValidHeaderGroup Some title\n@apiHeader (MyValidHeaderGroup) Content-Type' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {Object} packageInfos | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos) | ||
{ | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, "headerTitle"); | ||
} // preProcess | ||
function preProcess(parsedFiles, filenames, packageInfos) { | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, 'defineHeaderTitle'); | ||
} | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos) | ||
{ | ||
apiWorker.postProcess(parsedFiles, filenames, preProcessResults, packageInfos, "header", "headerTitle"); | ||
} // postProcess | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
apiWorker.postProcess(parsedFiles, filenames, preProcess, packageInfos, 'defineHeaderTitle', 'header', _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
@@ -0,83 +1,166 @@ | ||
var _ = require('lodash'); | ||
var semver = require('semver'); | ||
var WorkerError = require('../errors/worker_error'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiParam', | ||
usage : '@apiParam (group) varname', | ||
example: '@apiDefine MyValidParamGroup Some title\n@apiParam (MyValidParamGroup) username' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {Object} packageInfos | ||
* @param {String} target Target path in preProcess-Object (returned result), where the data should be set. | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos, defineStructureName) | ||
{ | ||
function preProcess(parsedFiles, filenames, packageInfos, target) { | ||
target = target || 'defineParamTitle'; | ||
var source = 'define'; // relative path to the tree (global.), from where the data should be fetched. | ||
var result = {}; | ||
defineStructureName = defineStructureName || "paramTitle"; | ||
result[defineStructureName] = []; | ||
result[target] = {}; | ||
parsedFiles.forEach(function(parsedFile){ | ||
parsedFile.forEach(function(block){ | ||
if(block.global[defineStructureName]) | ||
{ | ||
var entries = block.global[defineStructureName]; | ||
// Simple append, same Codes too. | ||
entries.forEach(function(entry){ | ||
result[defineStructureName].push(entry); | ||
}); | ||
// Unset | ||
delete(block.global[defineStructureName]); | ||
parsedFiles.forEach(function(parsedFile) { | ||
parsedFile.forEach(function(block) { | ||
if (block.global[source]) { | ||
var name = block.global[source].name; | ||
var version = block.version || '0.0.0'; | ||
if ( ! result[target][name]) | ||
result[target][name] = {}; | ||
// fetch from global | ||
result[target][name][version] = block.global[source]; | ||
} | ||
}); | ||
}); | ||
// remove empty target | ||
if (result[target].length === 0) | ||
delete result[target]; | ||
return result; | ||
} // preProcess | ||
} | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
* @param {String} source Source path in preProcess-Object | ||
* @param {String} target Relative path to the tree (local.), where the data should be modified. | ||
* @param {String} messages | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos, structureName, defineStructureName) | ||
{ | ||
structureName = structureName || "parameter"; | ||
defineStructureName = defineStructureName || "paramTitle"; | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos, source, target, messages) { | ||
source = source || 'defineParamTitle'; | ||
target = target || 'parameter'; | ||
messages = messages || _messages; | ||
var fields; | ||
var newBlock; | ||
var blockEntries; | ||
var found; | ||
parsedFiles.forEach(function(parsedFile){ | ||
parsedFile.forEach(function(block){ | ||
if(block.local[structureName] && block.local[structureName].fields) | ||
{ | ||
fields = block.local[structureName].fields; | ||
newBlock = {}; // preserve sorting | ||
Object.keys(fields).forEach(function(blockKey){ | ||
blockEntries = block.local[structureName].fields[blockKey]; | ||
found = false; | ||
preProcessResults[defineStructureName].forEach(function(preEntry){ | ||
if(preEntry.group === blockKey) | ||
{ | ||
found = true; | ||
newBlock[preEntry.title] = blockEntries; | ||
parsedFiles.forEach(function(parsedFile, parsedFileIndex) { | ||
parsedFile.forEach(function(block) { | ||
if ( ! block.local[target] || ! block.local[target].fields) | ||
return; | ||
var newFields = {}; | ||
var fields = block.local[target].fields; | ||
Object.keys(fields).forEach(function(fieldGroup) { | ||
var params = block.local[target].fields[fieldGroup]; | ||
params.forEach(function(definition) { | ||
var name = definition.group; | ||
var version = block.version || '0.0.0'; | ||
var matchedData = {}; | ||
if ( ! preProcess[source] || ! preProcess[source][name]) { | ||
// TODO: Enable in the next version | ||
// At the moment the (groupname) is optional and must not be defined. | ||
/* | ||
var extra = [ | ||
{ 'Groupname': name } | ||
]; | ||
throw new WorkerError('Referenced groupname does not exist / it is not defined with @apiDefine.', | ||
filenames[parsedFileIndex], | ||
block.index, | ||
messages.common.element, | ||
messages.common.usage, | ||
messages.common.example, | ||
extra); | ||
*/ | ||
// TODO: Remove in the next version | ||
matchedData.name = name; | ||
matchedData.title = name; | ||
} | ||
// TODO: Remove in the next version | ||
else { | ||
if (preProcess[source][name][version]) { | ||
// found the version | ||
matchedData = preProcess[source][name][version]; | ||
} else { | ||
// find nearest matching version | ||
var foundIndex = -1; | ||
var lastVersion = '0.0.0'; | ||
var versionKeys = Object.keys(preProcess[source][name]); | ||
versionKeys.forEach(function(currentVersion, versionIndex) { | ||
if (semver.gte(version, currentVersion) && semver.gte(currentVersion, lastVersion)) { | ||
lastVersion = currentVersion; | ||
foundIndex = versionIndex; | ||
} | ||
}); | ||
if (foundIndex === -1) { | ||
var extra = [ | ||
{ 'Groupname': name }, | ||
{ 'Version': version }, | ||
{ 'Defined versions': versionKeys }, | ||
]; | ||
throw new WorkerError('Referenced definition has no matching or a higher version. ' + | ||
'Check version number in referenced define block.', | ||
filenames[parsedFileIndex], | ||
block.index, | ||
messages.common.element, | ||
messages.common.usage, | ||
messages.common.example, | ||
extra); | ||
} | ||
}); | ||
if( ! found) | ||
{ | ||
newBlock[blockKey] = blockEntries; | ||
var versionName = versionKeys[foundIndex]; | ||
matchedData = preProcess[source][name][versionName]; | ||
} | ||
// TODO: Remove in the next version | ||
} | ||
if ( ! newFields[matchedData.title]) | ||
newFields[matchedData.title] = []; | ||
newFields[matchedData.title].push(definition); | ||
}); | ||
block.local[structureName].fields = newBlock; | ||
} | ||
}); | ||
// replace fields with new field header | ||
// TODO: reduce complexity and remove group | ||
block.local[target].fields = newFields; | ||
}); | ||
}); | ||
} | ||
} // postProcess | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
}; | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
@@ -1,34 +0,47 @@ | ||
var _ = require("lodash"); // Because of _.merge | ||
var semver = require("semver"); | ||
var semver = require('semver'); | ||
var WorkerError = require('../errors/worker_error'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiPermission', | ||
usage : '@apiPermission group', | ||
example: '@apiDefine MyValidPermissionGroup Some title\n@apiPermission MyValidPermissionGroup' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {String} useName | ||
* @param {String} defineName | ||
* @param {Object} packageInfos | ||
* @param {String} target Target path in preProcess-Object (returned result), where the data should be set. | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos, useName, defineName) | ||
{ | ||
defineName = defineName || "definePermission"; | ||
function preProcess(parsedFiles, filenames, packageInfos, target) { | ||
target = target || 'definePermission'; | ||
var source = 'define'; // relative path to the tree (global.), from where the data should be fetched. | ||
var result = {}; | ||
var name, version; | ||
parsedFiles.forEach(function(parsedFile){ | ||
parsedFile.forEach(function(block){ | ||
if(block.global[defineName]) | ||
{ | ||
name = block.global[defineName].name; | ||
version = block.version || "0.0.0"; | ||
result[target] = {}; | ||
if( ! result[defineName]) result[defineName] = {}; | ||
if( ! result[defineName][name]) result[defineName][name] = {}; | ||
parsedFiles.forEach(function(parsedFile) { | ||
parsedFile.forEach(function(block) { | ||
if (block.global[source]) { | ||
var name = block.global[source].name; | ||
var version = block.version || '0.0.0'; | ||
result[defineName][name][version] = block.global[defineName]; | ||
if ( ! result[target][name]) | ||
result[target][name] = {}; | ||
// fetch from local | ||
result[target][name][version] = block.global[source]; | ||
} | ||
}); | ||
}); | ||
if (result[target].length === 0) | ||
delete result[target]; | ||
return result; | ||
@@ -38,79 +51,98 @@ } | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {String} findName | ||
* @param {String} defineName | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
* @param {String} source Source path in preProcess-Object | ||
* @param {String} target Relative path to the tree (local.), where the data should be modified. | ||
* @param {String} messages | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos, findName, defineName) | ||
{ | ||
findName = findName || "permission"; | ||
defineName = defineName || "definePermission"; | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos, source, target, messages) { | ||
source = source || 'definePermission'; | ||
target = target || 'permission'; | ||
messages = messages || _messages; | ||
var name; | ||
var version; | ||
var matchedData; | ||
var matchedVersion; | ||
var foundIndex; | ||
var lastVersion; | ||
var versionKeys; | ||
var versionName; | ||
parsedFiles.forEach(function(parsedFile, parsedFileIndex){ | ||
parsedFile.forEach(function(block){ | ||
parsedFiles.forEach(function(parsedFile, parsedFileIndex) { | ||
parsedFile.forEach(function(block) { | ||
if ( ! block.local[target]) | ||
return; | ||
if(block.local[findName]) | ||
{ | ||
name = block.local[findName]; | ||
version = block.version || "0.0.0"; | ||
} | ||
var newPermissions = []; | ||
block.local[target].forEach(function(definition) { | ||
var name = definition.name; | ||
var version = block.version || '0.0.0'; | ||
var matchedData = {}; | ||
if(preProcessResults[defineName] && preProcessResults[defineName][name]) | ||
{ | ||
matchedData = {}; | ||
matchedVersion = version; | ||
if(preProcessResults[defineName][name][version]) | ||
{ | ||
// Exact Version | ||
matchedData = preProcessResults[defineName][name][version]; | ||
} | ||
else | ||
{ | ||
// Find matching version | ||
foundIndex = -1; | ||
lastVersion = "0.0.0"; | ||
if ( ! preProcess[source] || ! preProcess[source][name]) { | ||
// TODO: Enable in the next version | ||
// At the moment the (groupname) is optional and must not be defined. | ||
/* | ||
var extra = [ | ||
{ 'Groupname': name } | ||
]; | ||
throw new WorkerError('Referenced groupname does not exist / it is not defined with @apiDefine.', | ||
filenames[parsedFileIndex], | ||
block.index, | ||
messages.common.element, | ||
messages.common.usage, | ||
messages.common.example, | ||
extra); | ||
*/ | ||
// TODO: Remove in the next version | ||
matchedData.name = name; | ||
matchedData.title = definition.title; | ||
matchedData.description = definition.description; | ||
versionKeys = Object.keys(preProcessResults[defineName][name]); | ||
versionKeys.forEach(function(versionKey, i){ | ||
if(semver.gte(version, versionKey) && semver.gte(versionKey, lastVersion)) | ||
{ | ||
lastVersion = versionKey; | ||
foundIndex = i; | ||
} | ||
// TODO: Remove in the next version | ||
else { | ||
if (preProcess[source][name][version]) { | ||
// found the version | ||
matchedData = preProcess[source][name][version]; | ||
} else { | ||
// find nearest matching version | ||
var foundIndex = -1; | ||
var lastVersion = '0.0.0'; | ||
var versionKeys = Object.keys(preProcess[source][name]); | ||
versionKeys.forEach(function(currentVersion, versionIndex) { | ||
if (semver.gte(version, currentVersion) && semver.gte(currentVersion, lastVersion)) { | ||
lastVersion = currentVersion; | ||
foundIndex = versionIndex; | ||
} | ||
}); | ||
if(foundIndex === -1) | ||
{ | ||
throw new Error("Name \"" + name + "\" in file \"" + filenames[parsedFileIndex] + | ||
"\" block number " + block.index + " has no matching version. " + | ||
"Check if referenced definition block has a higher version number." | ||
); | ||
if (foundIndex === -1) { | ||
var extra = [ | ||
{ 'Groupname': name }, | ||
{ 'Version': version }, | ||
{ 'Defined versions': versionKeys }, | ||
]; | ||
throw new WorkerError('Referenced definition has no matching or a higher version. ' + | ||
'Check version number in referenced define block.', | ||
filenames[parsedFileIndex], | ||
block.index, | ||
messages.common.element, | ||
messages.common.usage, | ||
messages.common.example, | ||
extra); | ||
} | ||
versionName = versionKeys[foundIndex]; | ||
matchedData = preProcessResults[defineName][name][versionName]; | ||
var versionName = versionKeys[foundIndex]; | ||
matchedData = preProcess[source][name][versionName]; | ||
} | ||
// Copy matched elements into parsed block | ||
block.local[findName] = matchedData; | ||
} | ||
// else | ||
// { | ||
// // TODO: Show warning (no error). | ||
// throw new Error("Name \"" + name + "\" in file \"" + filenames[parsedFileIndex] + | ||
// "\" block number " + block.index + " is not defined." | ||
// ); | ||
// } | ||
// TODO: Remove in the next version | ||
} | ||
newPermissions.push(matchedData); | ||
}); | ||
// replace permissions with new permissions | ||
// TODO: reduce complexity and remove group | ||
block.local[target] = newPermissions; | ||
}); | ||
@@ -121,7 +153,7 @@ }); | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos) | ||
{ | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
var targetName = 'sampleRequest'; | ||
parsedFiles.forEach(function(parsedFile, parsedFileIndex) { | ||
parsedFile.forEach(function(block) { | ||
if (block.local["sampleRequest"]) { | ||
if (block.local[targetName]) { | ||
var newBlock = []; | ||
block.local["sampleRequest"].forEach(function(entry) { | ||
if(entry.url !== "off") { | ||
block.local[targetName].forEach(function(entry) { | ||
if (entry.url !== 'off') { | ||
// Check if is an internal url | ||
if (packageInfos.sampleUrl && entry.url.length >= 4 && entry.url.substr(0, 4).toLowerCase() !== "http") { | ||
if (packageInfos.sampleUrl && entry.url.length >= 4 && entry.url.substr(0, 4).toLowerCase() !== 'http') { | ||
// Prepend sampleUrl | ||
@@ -21,20 +27,22 @@ entry.url = packageInfos.sampleUrl + entry.url; | ||
if(newBlock.length === 0) delete block.local["sampleRequest"]; | ||
else block.local["sampleRequest"] = newBlock; | ||
if (newBlock.length === 0) | ||
delete block.local[targetName]; | ||
else | ||
block.local[targetName] = newBlock; | ||
} else { | ||
if (packageInfos.sampleUrl && block.local && block.local["url"]) { | ||
block.local["sampleRequest"] = [{ | ||
"url": packageInfos.sampleUrl + block.local["url"] | ||
if (packageInfos.sampleUrl && block.local && block.local['url']) { | ||
block.local[targetName] = [{ | ||
'url': packageInfos.sampleUrl + block.local['url'] | ||
}]; | ||
} | ||
} | ||
}); // forEach | ||
}); // forEach | ||
}); | ||
}); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
postProcess: postProcess | ||
}; | ||
postProcess: postProcess | ||
}; |
@@ -1,156 +0,43 @@ | ||
var _ = require("lodash"); // Because of _.merge | ||
var semver = require("semver"); | ||
// Same as @apiUse | ||
var apiWorker = require('./api_use.js'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiStructure', | ||
usage : '@apiStructure group', | ||
example: '@apiDefine MyValidStructureGroup Some title\n@apiStructure MyValidStructureGroup' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {String} structureName | ||
* @param {String} defineStructureName | ||
* @param {Object} packageInfos | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos, structureName, defineStructureName) | ||
{ | ||
defineStructureName = defineStructureName || "defineStructure"; | ||
var result = {}; | ||
function preProcess(parsedFiles, filenames, packageInfos) { | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, 'defineStructure'); | ||
} | ||
var name; | ||
var version; | ||
parsedFiles.forEach(function(parsedFile){ | ||
parsedFile.forEach(function(block){ | ||
if(block.global[defineStructureName]) | ||
{ | ||
name = block.global[defineStructureName]; | ||
version = block.version || "0.0.0"; | ||
if( ! result[defineStructureName]) result[defineStructureName] = {}; | ||
if( ! result[defineStructureName][name]) result[defineStructureName][name] = {}; | ||
result[defineStructureName][name][version] = block.local; | ||
} | ||
}); | ||
}); | ||
return result; | ||
} // preProcess | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {String} structureName | ||
* @param {String} defineStructureName | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos, structureName, defineStructureName) | ||
{ | ||
structureName = structureName || "structure"; | ||
defineStructureName = defineStructureName || "defineStructure"; | ||
var version; | ||
var matchedData; | ||
var matchedVersion; | ||
var foundIndex; | ||
var lastVersion; | ||
var versionName; | ||
var versionKeys; | ||
parsedFiles.forEach(function(parsedFile, parsedFileIndex){ | ||
parsedFile.forEach(function(block){ | ||
if(block.local[structureName]) | ||
{ | ||
block.local[structureName].forEach(function(name){ | ||
var version = block.version || "0.0.0"; | ||
if(preProcessResults[defineStructureName][name]) | ||
{ | ||
matchedData = {}; | ||
matchedVersion = version; | ||
if(preProcessResults[defineStructureName][name][version]) | ||
{ | ||
// Exact Version | ||
matchedData = preProcessResults[defineStructureName][name][version]; | ||
} | ||
else | ||
{ | ||
// Find matching version | ||
foundIndex = -1; | ||
lastVersion = "0.0.0"; | ||
versionKeys = Object.keys(preProcessResults[defineStructureName][name]); | ||
versionKeys.map(function(currentVersion, versionIndex){ | ||
if(semver.gte(version, currentVersion) && semver.gte(currentVersion, lastVersion)) | ||
{ | ||
lastVersion = currentVersion; | ||
foundIndex = versionIndex; | ||
} | ||
}); | ||
if(foundIndex === -1) | ||
{ | ||
throw new Error("Name \"" + name + "\" in file \"" + filenames[parsedFileIndex] + | ||
"\" block number " + block.index + " has no matching version. " + | ||
"Check if referenced definition block has a higher version number." | ||
); | ||
} | ||
versionName = versionKeys[foundIndex]; | ||
matchedData = preProcessResults[defineStructureName][name][versionName]; | ||
} | ||
// Copy matched elements into parsed block | ||
_recursiveMerge(block.local, matchedData); | ||
} | ||
else | ||
{ | ||
throw new Error("Name \"" + name + "\" in file \"" + filenames[parsedFileIndex] + | ||
"\" block number " + block.index + " is not defined." | ||
); | ||
} | ||
}); | ||
delete block.local[structureName]; | ||
} | ||
}); | ||
}); | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
apiWorker.postProcess(parsedFiles, filenames, preProcess, packageInfos, 'defineStructure', 'structure', _messages); | ||
} | ||
/** | ||
* Recursive Merge of Objects with Arrays. | ||
* | ||
* @param block | ||
* @param matchedData | ||
* @todo Bad Hack - watch for something better | ||
* Exports | ||
*/ | ||
function _recursiveMerge(block, matchedData) | ||
{ | ||
_.merge(block, matchedData, function(a, b) { | ||
if(a instanceof Array) | ||
{ | ||
return a.concat(b); | ||
} | ||
if(_.isObject(a)) | ||
{ | ||
_recursiveMerge(a, b); | ||
} | ||
return a; | ||
}); | ||
} // _recursiveMerge | ||
/** | ||
* Exports. | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
}; | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
@@ -1,35 +0,43 @@ | ||
var apiWorker = require("./api_structure.js"); | ||
// Same as @apiUse | ||
var apiWorker = require('./api_use.js'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiSuccessStructure', | ||
usage : '@apiSuccessStructure group', | ||
example: '@apiDefine MyValidSuccessStructureGroup Some title\n@apiSuccessStructure MyValidSuccessStructureGroup' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {Object} packageInfos | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos) | ||
{ | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, "successStructure", "defineSuccessStructure"); | ||
} // preProcess | ||
function preProcess(parsedFiles, filenames, packageInfos) { | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, 'defineSuccessStructure'); | ||
} | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos) | ||
{ | ||
apiWorker.postProcess(parsedFiles, filenames, preProcessResults, packageInfos, "successStructure", "defineSuccessStructure"); | ||
} // postProcess | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
apiWorker.postProcess(parsedFiles, filenames, preProcess, packageInfos, 'defineSuccessStructure', 'successStructure', _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
}; | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
@@ -1,35 +0,43 @@ | ||
var apiWorker = require("./api_param_title.js"); | ||
// Same as @apiParamTitle | ||
var apiWorker = require('./api_param_title.js'); | ||
// Additional information for error log | ||
var _messages = { | ||
common: { | ||
element: 'apiSuccess', | ||
usage : '@apiSuccess (group) varname', | ||
example: '@apiDefine MyValidSuccessGroup Some title or 200 OK\n@apiSuccess (MyValidSuccessGroup) username' | ||
} | ||
}; | ||
/** | ||
* PreProcess. | ||
* PreProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object} packageInfos | ||
* @param {Object} packageInfos | ||
* @returns {Object} | ||
*/ | ||
function preProcess(parsedFiles, filenames, packageInfos) | ||
{ | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, "successTitle"); | ||
} // preProcess | ||
function preProcess(parsedFiles, filenames, packageInfos) { | ||
return apiWorker.preProcess(parsedFiles, filenames, packageInfos, 'defineSuccessTitle'); | ||
} | ||
/** | ||
* PostProcess. | ||
* PostProcess | ||
* | ||
* @param {Object[]} parsedFiles | ||
* @param {String[]} filenames | ||
* @param {Object[]} preProcessResults | ||
* @param {Object} packageInfos | ||
* @param {Object[]} preProcess | ||
* @param {Object} packageInfos | ||
*/ | ||
function postProcess(parsedFiles, filenames, preProcessResults, packageInfos) | ||
{ | ||
apiWorker.postProcess(parsedFiles, filenames, preProcessResults, packageInfos, "success", "successTitle"); | ||
} // postProcess | ||
function postProcess(parsedFiles, filenames, preProcess, packageInfos) { | ||
apiWorker.postProcess(parsedFiles, filenames, preProcess, packageInfos, 'defineSuccessTitle', 'success', _messages); | ||
} | ||
/** | ||
* Exports. | ||
* Exports | ||
*/ | ||
module.exports = { | ||
preProcess: preProcess, | ||
postProcess: postProcess | ||
}; | ||
preProcess : preProcess, | ||
postProcess: postProcess | ||
}; |
{ | ||
"name": "apidoc", | ||
"version": "0.7.2", | ||
"version": "0.8.0", | ||
"description": "RESTful web API Documentation Generator", | ||
@@ -21,2 +21,5 @@ "author": "Peter Rottmann <rottmann@inveris.de>", | ||
"bin": "bin/apidoc", | ||
"scripts": { | ||
"test": "grunt test" | ||
}, | ||
"keywords": [ | ||
@@ -34,9 +37,8 @@ "api", | ||
"dependencies": { | ||
"colors": "~0.6.2", | ||
"fs-extra": "~0.9.1", | ||
"colors": "~1.0.3", | ||
"fs-extra": "~0.12.0", | ||
"lodash": "~2.4.1", | ||
"marked": "~0.3.2", | ||
"optimist": "~0.6.1", | ||
"semver": "~2.3.0", | ||
"underscore": "~1.6.0", | ||
"semver": "~4.1.0", | ||
"wrench": "~1.5.8" | ||
@@ -46,7 +48,7 @@ }, | ||
"grunt": "~0.4.5", | ||
"grunt-contrib-clean": "~0.5.0", | ||
"grunt-contrib-clean": "~0.6.0", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"grunt-simple-mocha": "~0.4.0", | ||
"should": "~4.0.1" | ||
"should": "~4.2.1" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# apiDoc 0.7.x | ||
# apiDoc 0.8.x | ||
@@ -8,2 +8,4 @@ Generates a RESTful web API Documentation. | ||
apiDoc creates a documentation from API descriptions in your source code. | ||
Documentation at [apidocjs.com](http://apidocjs.com). | ||
@@ -19,5 +21,10 @@ | ||
## Changelog | ||
[CHANGELOG.md](https://github.com/apidoc/apidoc/blob/master/CHANGELOG.md) | ||
## Example | ||
```javascript | ||
```javascript | ||
/** | ||
@@ -33,3 +40,3 @@ * @api {get} /user/:id Request User information | ||
*/ | ||
``` | ||
``` | ||
@@ -41,2 +48,5 @@ `apidoc -i example/ -o doc/` | ||
More examples and best practice hints: [EXAMPLES.md](https://github.com/apidoc/apidoc/blob/master/EXAMPLES.md) | ||
## Supported programming languages | ||
@@ -75,3 +85,3 @@ | ||
``` | ||
```perl | ||
@@ -105,10 +115,6 @@ =pod | ||
## Changelog | ||
[CHANGELOG.md](https://github.com/apidoc/apidoc/blob/master/CHANGELOG.md) | ||
## Help | ||
Please add [issues](https://github.com/apidoc/apidoc/issues) if you have a question or found a problem. Pull requests are welcome too! | ||
Please add [issues](https://github.com/apidoc/apidoc/issues) if you have a question or found a problem. | ||
Pull requests are welcome too! | ||
@@ -115,0 +121,0 @@ A chat about apiDoc is on [Gitter](https://gitter.im/apidoc/talk). |
define([ | ||
"locales", | ||
"handlebars", | ||
"diffMatchPatch" | ||
'locales', | ||
'handlebars', | ||
'diffMatchPatch' | ||
], function(locale, Handlebars, DiffMatchPatch) { | ||
/** | ||
* Return localized Text. | ||
* @param string text | ||
*/ | ||
Handlebars.registerHelper("__", function(text){ | ||
return locale.__(text); | ||
}); | ||
/** | ||
* Return localized Text. | ||
* @param string text | ||
*/ | ||
Handlebars.registerHelper('__', function(text) { | ||
return locale.__(text); | ||
}); | ||
/** | ||
* Console log. | ||
* @param mixed obj | ||
*/ | ||
Handlebars.registerHelper("cl", function(obj){ | ||
console.log(obj); | ||
return ""; | ||
}); | ||
/** | ||
* Console log. | ||
* @param mixed obj | ||
*/ | ||
Handlebars.registerHelper('cl', function(obj) { | ||
console.log(obj); | ||
return ''; | ||
}); | ||
/** | ||
* Replace underscore with space. | ||
* @param string text | ||
*/ | ||
Handlebars.registerHelper("underscoreToSpace", function(text){ | ||
return text.replace(/(_+)/g, " "); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("assign", function(name) { | ||
if(arguments.length > 0) | ||
{ | ||
var type = typeof(arguments[1]); | ||
var arg = null; | ||
if(type === "string" || type === "number" || type === "boolean") arg = arguments[1]; | ||
Handlebars.registerHelper(name, function() { return arg; }); | ||
} | ||
return ""; | ||
}); | ||
/** | ||
* Replace underscore with space. | ||
* @param string text | ||
*/ | ||
Handlebars.registerHelper('underscoreToSpace', function(text) { | ||
return text.replace(/(_+)/g, ' '); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("nl2br", function(text) { | ||
return _handlebarsNewlineToBreak(text); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('assign', function(name) { | ||
if(arguments.length > 0) { | ||
var type = typeof(arguments[1]); | ||
var arg = null; | ||
if(type === 'string' || type === 'number' || type === 'boolean') arg = arguments[1]; | ||
Handlebars.registerHelper(name, function() { return arg; }); | ||
} | ||
return ''; | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("if_eq", function(context, options) { | ||
if(context === options.hash.compare) return options.fn(this); | ||
return options.inverse(this); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('nl2br', function(text) { | ||
return _handlebarsNewlineToBreak(text); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("subTemplate", function(name, sourceContext) { | ||
var template = Handlebars.compile($("#template-" + name).html()); | ||
var templateContext = $.extend({}, this, sourceContext.hash); | ||
return new Handlebars.SafeString( template(templateContext) ); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("toLowerCase", function(value) { | ||
return (value && typeof value === "string") ? value.toLowerCase() : ''; | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('if_eq', function(context, options) { | ||
var compare = context; | ||
// Get length if context is an object | ||
if (context instanceof Object && ! (options.hash.compare instanceof Object)) | ||
compare = Object.keys(context).length; | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("splitFill", function(value, splitChar, fillChar) { | ||
var splits = value.split(splitChar); | ||
return new Array(splits.length).join(fillChar) + splits[splits.length - 1]; | ||
}); | ||
if (compare === options.hash.compare) | ||
return options.fn(this); | ||
/** | ||
* Convert Newline to HTML-Break (nl2br). | ||
* | ||
* @param {String} text | ||
* @returns {String} | ||
*/ | ||
function _handlebarsNewlineToBreak(text) | ||
{ | ||
return (text + "").replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, "$1" + "<br>" + "$2"); | ||
} // _handlebarsNewlineToBreak | ||
return options.inverse(this); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("each_compare_keys", function(source, compare, options) { | ||
var newSource = []; | ||
if(source) | ||
{ | ||
var sourceFields = Object.keys(source); | ||
sourceFields.forEach(function(name) { | ||
var values = {}; | ||
values["value"] = source[name]; | ||
values["key"] = name; | ||
newSource.push(values); | ||
}); | ||
} | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('if_gt', function(context, options) { | ||
var compare = context; | ||
// Get length if context is an object | ||
if (context instanceof Object && ! (options.hash.compare instanceof Object)) | ||
compare = Object.keys(context).length; | ||
var newCompare = []; | ||
if(compare) | ||
{ | ||
var compareFields = Object.keys(compare); | ||
compareFields.forEach(function(name) { | ||
var values = {}; | ||
values["value"] = compare[name]; | ||
values["key"] = name; | ||
newCompare.push(values); | ||
}); | ||
} | ||
return _handlebarsEachCompared("key", newSource, newCompare, options); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("each_compare_field", function(source, compare, options) { | ||
return _handlebarsEachCompared("field", source, compare, options); | ||
}); | ||
if(compare > options.hash.compare) | ||
return options.fn(this); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("each_compare_title", function(source, compare, options) { | ||
return _handlebarsEachCompared("title", source, compare, options); | ||
}); | ||
return options.inverse(this); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper("showDiff", function(source, compare, options) { | ||
var ds = ""; | ||
if(source === compare) ds = source; | ||
else | ||
{ | ||
if( ! source) return compare; | ||
if( ! compare) return source; | ||
var d = diffMatchPatch.diff_main(compare, source); | ||
diffMatchPatch.diff_cleanupSemantic(d); | ||
ds = diffMatchPatch.diff_prettyHtml(d); | ||
ds = ds.replace(/¶/gm, ""); | ||
} | ||
if(options === "nl2br") ds = _handlebarsNewlineToBreak(ds); | ||
return ds; | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('subTemplate', function(name, sourceContext) { | ||
var template = Handlebars.compile($('#template-' + name).html()); | ||
var templateContext = $.extend({}, this, sourceContext.hash); | ||
return new Handlebars.SafeString( template(templateContext) ); | ||
}); | ||
/** | ||
* | ||
*/ | ||
function _handlebarsEachCompared(fieldname, source, compare, options) | ||
{ | ||
var dataList = []; | ||
var index = 0; | ||
if(source) | ||
{ | ||
source.forEach(function(sourceEntry) { | ||
var found = false; | ||
if(compare) | ||
{ | ||
compare.forEach(function(compareEntry) { | ||
if(sourceEntry[fieldname] === compareEntry[fieldname]) | ||
{ | ||
var data = { | ||
typeSame: true, | ||
source: sourceEntry, | ||
compare: compareEntry, | ||
index: index | ||
}; | ||
dataList.push(data); | ||
found = true; | ||
index++; | ||
} | ||
}); | ||
} | ||
if( ! found) | ||
{ | ||
var data = { | ||
typeIns: true, | ||
source: sourceEntry, | ||
index: index | ||
}; | ||
dataList.push(data); | ||
index++; | ||
} | ||
}); | ||
} | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('toLowerCase', function(value) { | ||
return (value && typeof value === 'string') ? value.toLowerCase() : ''; | ||
}); | ||
if(compare) | ||
{ | ||
compare.forEach(function(compareEntry) { | ||
var found = false; | ||
if(source) | ||
{ | ||
source.forEach(function(sourceEntry) { | ||
if(sourceEntry[fieldname] === compareEntry[fieldname]) | ||
{ | ||
found = true; | ||
} | ||
}); | ||
} | ||
if( ! found) | ||
{ | ||
var data = { | ||
typeDel: true, | ||
compare: compareEntry, | ||
index: index | ||
}; | ||
dataList.push(data); | ||
index++; | ||
} | ||
}); | ||
} | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('splitFill', function(value, splitChar, fillChar) { | ||
var splits = value.split(splitChar); | ||
return new Array(splits.length).join(fillChar) + splits[splits.length - 1]; | ||
}); | ||
var ret = ""; | ||
for(var index in dataList) | ||
{ | ||
ret = ret + options.fn(dataList[index]); | ||
} // for | ||
return ret; | ||
} // _handlebarsEachCompared | ||
/** | ||
* Convert Newline to HTML-Break (nl2br). | ||
* | ||
* @param {String} text | ||
* @returns {String} | ||
*/ | ||
function _handlebarsNewlineToBreak(text) { | ||
return ('' + text).replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br>' + '$2'); | ||
} | ||
var diffMatchPatch = new DiffMatchPatch(); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('each_compare_list_field', function(source, compare, options) { | ||
var fieldName = options.hash.field; | ||
var newSource = []; | ||
if (source) { | ||
source.forEach(function(entry) { | ||
var values = entry; | ||
values['key'] = entry[fieldName]; | ||
newSource.push(values); | ||
}); | ||
} | ||
/** | ||
* Overwrite Colors | ||
*/ | ||
DiffMatchPatch.prototype.diff_prettyHtml = function(diffs) { | ||
var html = []; | ||
var pattern_amp = /&/g; | ||
var pattern_lt = /</g; | ||
var pattern_gt = />/g; | ||
var pattern_para = /\n/g; | ||
for (var x = 0; x < diffs.length; x++) { | ||
var op = diffs[x][0]; // Operation (insert, delete, equal) | ||
var data = diffs[x][1]; // Text of change. | ||
var text = data.replace(pattern_amp, '&').replace(pattern_lt, '<') | ||
.replace(pattern_gt, '>').replace(pattern_para, '¶<br>'); | ||
switch (op) { | ||
case DIFF_INSERT: | ||
html[x] = '<ins>' + text + '</ins>'; | ||
break; | ||
case DIFF_DELETE: | ||
html[x] = '<del>' + text + '</del>'; | ||
break; | ||
case DIFF_EQUAL: | ||
html[x] = '<span>' + text + '</span>'; | ||
break; | ||
} | ||
} | ||
return html.join(''); | ||
}; | ||
var newCompare = []; | ||
if (compare) { | ||
compare.forEach(function(entry) { | ||
var values = entry; | ||
values['key'] = entry[fieldName]; | ||
newCompare.push(values); | ||
}); | ||
} | ||
return _handlebarsEachCompared('key', newSource, newCompare, options); | ||
}); | ||
return Handlebars; | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('each_compare_keys', function(source, compare, options) { | ||
var newSource = []; | ||
if (source) { | ||
var sourceFields = Object.keys(source); | ||
sourceFields.forEach(function(name) { | ||
var values = {}; | ||
values['value'] = source[name]; | ||
values['key'] = name; | ||
newSource.push(values); | ||
}); | ||
} | ||
var newCompare = []; | ||
if (compare) { | ||
var compareFields = Object.keys(compare); | ||
compareFields.forEach(function(name) { | ||
var values = {}; | ||
values['value'] = compare[name]; | ||
values['key'] = name; | ||
newCompare.push(values); | ||
}); | ||
} | ||
return _handlebarsEachCompared('key', newSource, newCompare, options); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('each_compare_field', function(source, compare, options) { | ||
return _handlebarsEachCompared('field', source, compare, options); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('each_compare_title', function(source, compare, options) { | ||
return _handlebarsEachCompared('title', source, compare, options); | ||
}); | ||
/** | ||
* | ||
*/ | ||
Handlebars.registerHelper('showDiff', function(source, compare, options) { | ||
var ds = ''; | ||
if(source === compare) { | ||
ds = source; | ||
} else { | ||
if( ! source) | ||
return compare; | ||
if( ! compare) | ||
return source; | ||
var d = diffMatchPatch.diff_main(compare, source); | ||
diffMatchPatch.diff_cleanupSemantic(d); | ||
ds = diffMatchPatch.diff_prettyHtml(d); | ||
ds = ds.replace(/¶/gm, ''); | ||
} | ||
if(options === 'nl2br') | ||
ds = _handlebarsNewlineToBreak(ds); | ||
return ds; | ||
}); | ||
/** | ||
* | ||
*/ | ||
function _handlebarsEachCompared(fieldname, source, compare, options) | ||
{ | ||
var dataList = []; | ||
var index = 0; | ||
if(source) { | ||
source.forEach(function(sourceEntry) { | ||
var found = false; | ||
if (compare) { | ||
compare.forEach(function(compareEntry) { | ||
if(sourceEntry[fieldname] === compareEntry[fieldname]) { | ||
var data = { | ||
typeSame: true, | ||
source: sourceEntry, | ||
compare: compareEntry, | ||
index: index | ||
}; | ||
dataList.push(data); | ||
found = true; | ||
index++; | ||
} | ||
}); | ||
} | ||
if ( ! found) { | ||
var data = { | ||
typeIns: true, | ||
source: sourceEntry, | ||
index: index | ||
}; | ||
dataList.push(data); | ||
index++; | ||
} | ||
}); | ||
} | ||
if (compare) { | ||
compare.forEach(function(compareEntry) { | ||
var found = false; | ||
if (source) { | ||
source.forEach(function(sourceEntry) { | ||
if(sourceEntry[fieldname] === compareEntry[fieldname]) | ||
found = true; | ||
}); | ||
} | ||
if ( ! found) { | ||
var data = { | ||
typeDel: true, | ||
compare: compareEntry, | ||
index: index | ||
}; | ||
dataList.push(data); | ||
index++; | ||
} | ||
}); | ||
} | ||
var ret = ''; | ||
var length = dataList.length; | ||
for (var index in dataList) { | ||
if(index == (length - 1)) | ||
dataList[index]['_last'] = true; | ||
ret = ret + options.fn(dataList[index]); | ||
} | ||
return ret; | ||
} | ||
var diffMatchPatch = new DiffMatchPatch(); | ||
/** | ||
* Overwrite Colors | ||
*/ | ||
DiffMatchPatch.prototype.diff_prettyHtml = function(diffs) { | ||
var html = []; | ||
var pattern_amp = /&/g; | ||
var pattern_lt = /</g; | ||
var pattern_gt = />/g; | ||
var pattern_para = /\n/g; | ||
for (var x = 0; x < diffs.length; x++) { | ||
var op = diffs[x][0]; // Operation (insert, delete, equal) | ||
var data = diffs[x][1]; // Text of change. | ||
var text = data.replace(pattern_amp, '&').replace(pattern_lt, '<') | ||
.replace(pattern_gt, '>').replace(pattern_para, '¶<br>'); | ||
switch (op) { | ||
case DIFF_INSERT: | ||
html[x] = '<ins>' + text + '</ins>'; | ||
break; | ||
case DIFF_DELETE: | ||
html[x] = '<del>' + text + '</del>'; | ||
break; | ||
case DIFF_EQUAL: | ||
html[x] = '<span>' + text + '</span>'; | ||
break; | ||
} | ||
} | ||
return html.join(''); | ||
}; | ||
// Exports | ||
return Handlebars; | ||
}); |
define({ | ||
de: { | ||
"Compare all with predecessor": "Vergleiche alle mit ihren Vorgängern", | ||
"compare changes to:" : "vergleiche Änderungen mit:", | ||
"compared to" : "verglichen mit", | ||
"Default value:" : "Standardwert:", | ||
"Description" : "Beschreibung", | ||
"Field" : "Feld", | ||
"General" : "Allgemein", | ||
"Generated with" : "Erstellt mit", | ||
"Name" : "Name", | ||
"No response values." : "Keine Rückgabewerte.", | ||
"optional" : "optional", | ||
"Parameter" : "Parameter", | ||
"Permission:" : "Berechtigung:", | ||
"Response" : "Antwort", | ||
"Send" : "Senden", | ||
"Send a Sample Request" : "Eine Beispielanfrage senden", | ||
"show up to version:" : "zeige bis zur Version:", | ||
"Type" : "Typ", | ||
"url" : "url" | ||
} | ||
}); | ||
de: { | ||
'Allowed values:' : 'Erlaubte Werte:', | ||
'Compare all with predecessor': 'Vergleiche alle mit ihren Vorgängern', | ||
'compare changes to:' : 'vergleiche Änderungen mit:', | ||
'compared to' : 'verglichen mit', | ||
'Default value:' : 'Standardwert:', | ||
'Description' : 'Beschreibung', | ||
'Field' : 'Feld', | ||
'General' : 'Allgemein', | ||
'Generated with' : 'Erstellt mit', | ||
'Name' : 'Name', | ||
'No response values.' : 'Keine Rückgabewerte.', | ||
'optional' : 'optional', | ||
'Parameter' : 'Parameter', | ||
'Permission:' : 'Berechtigung:', | ||
'Response' : 'Antwort', | ||
'Send' : 'Senden', | ||
'Send a Sample Request' : 'Eine Beispielanfrage senden', | ||
'show up to version:' : 'zeige bis zur Version:', | ||
'Size range:' : 'Größenbereich:', | ||
'Type' : 'Typ', | ||
'url' : 'url' | ||
} | ||
}); |
define([ | ||
"./locales/de.js" | ||
'./locales/de.js' | ||
], function() { | ||
var locales = {}; | ||
for(index in arguments) | ||
{ | ||
for(property in arguments[index]) | ||
{ | ||
locales[property] = arguments[index][property]; | ||
} // for | ||
} // for | ||
var language = ((navigator.language) ? navigator.language : navigator.userLanguage).substr(0, 2).toLowerCase(); | ||
if( ! locales["en"]) locales["en"] = {}; | ||
if( ! locales[language]) language = "en"; | ||
var locales = {}; | ||
for(index in arguments) | ||
{ | ||
for(property in arguments[index]) | ||
{ | ||
locales[property] = arguments[index][property]; | ||
} // for | ||
} // for | ||
var locale = locales[language]; | ||
var language = ((navigator.language) ? navigator.language : navigator.userLanguage).substr(0, 2).toLowerCase(); | ||
if( ! locales['en']) locales['en'] = {}; | ||
if( ! locales[language]) language = 'en'; | ||
var __ = function(text) | ||
{ | ||
var index = locale[text]; | ||
if(index === undefined) return text; | ||
return index; | ||
}; // __ | ||
return { | ||
__: __, | ||
locales: locales, | ||
locale: locale | ||
}; | ||
}); | ||
var locale = locales[language]; | ||
var __ = function(text) | ||
{ | ||
var index = locale[text]; | ||
if(index === undefined) return text; | ||
return index; | ||
}; // __ | ||
return { | ||
__: __, | ||
locales: locales, | ||
locale: locale | ||
}; | ||
}); |
1153
template/main.js
require.config({ | ||
paths: { | ||
bootstrap: "./vendor/bootstrap.min", | ||
diffMatchPatch: "./vendor/diff_match_patch.min", | ||
handlebars: "./vendor/handlebars.min", | ||
handlebarsExtended: "./handlebars_helper", | ||
jquery: "./vendor/jquery.min", | ||
locales: "./locales/locale", | ||
lodash: "./vendor/lodash.min", | ||
prettify: "./vendor/prettify/prettify", | ||
utilsSampleRequest: "utils/send_sample_request" | ||
}, | ||
shim: { | ||
bootstrap: { | ||
deps: ["jquery"] | ||
}, | ||
diffMatchPatch: { | ||
exports: "diff_match_patch" | ||
}, | ||
handlebars: { | ||
exports: "Handlebars" | ||
}, | ||
handlebarsExtended: { | ||
deps: ["jquery", "handlebars"], | ||
exports: "Handlebars" | ||
}, | ||
prettify: { | ||
exports: "prettyPrint" | ||
} | ||
}, | ||
urlArgs: "v=" + (new Date()).getTime(), | ||
waitSeconds: 15 | ||
paths: { | ||
bootstrap: './vendor/bootstrap.min', | ||
diffMatchPatch: './vendor/diff_match_patch.min', | ||
handlebars: './vendor/handlebars.min', | ||
handlebarsExtended: './handlebars_helper', | ||
jquery: './vendor/jquery.min', | ||
locales: './locales/locale', | ||
lodash: './vendor/lodash.min', | ||
pathToRegexp: './vendor/path-to-regexp/index', | ||
prettify: './vendor/prettify/prettify', | ||
utilsSampleRequest: './utils/send_sample_request', | ||
}, | ||
shim: { | ||
bootstrap: { | ||
deps: ['jquery'] | ||
}, | ||
diffMatchPatch: { | ||
exports: 'diff_match_patch' | ||
}, | ||
handlebars: { | ||
exports: 'Handlebars' | ||
}, | ||
handlebarsExtended: { | ||
deps: ['jquery', 'handlebars'], | ||
exports: 'Handlebars' | ||
}, | ||
prettify: { | ||
exports: 'prettyPrint' | ||
} | ||
}, | ||
urlArgs: 'v=' + (new Date()).getTime(), | ||
waitSeconds: 15 | ||
}); | ||
require([ | ||
"jquery", | ||
"lodash", | ||
"locales", | ||
"handlebarsExtended", | ||
"./api_project.js", | ||
"./api_data.js", | ||
"prettify", | ||
"utilsSampleRequest", | ||
"bootstrap", | ||
'jquery', | ||
'lodash', | ||
'locales', | ||
'handlebarsExtended', | ||
'./api_project.js', | ||
'./api_data.js', | ||
'prettify', | ||
'utilsSampleRequest', | ||
'bootstrap', | ||
'pathToRegexp' | ||
], function($, _, locale, Handlebars, apiProject, apiData, prettyPrint, sampleRequest) { | ||
/** | ||
* Load google web fonts. | ||
*/ | ||
/** | ||
* Load google web fonts. | ||
*/ | ||
loadGoogleFontCss($); | ||
var api = apiData.api; | ||
var api = apiData.api; | ||
/** | ||
* Templates. | ||
*/ | ||
var templateHeader = Handlebars.compile( $("#template-header").html() ); | ||
var templateFooter = Handlebars.compile( $("#template-footer").html() ); | ||
var templateArticle = Handlebars.compile( $("#template-article").html() ); | ||
var templateCompareArticle = Handlebars.compile( $("#template-compare-article").html() ); | ||
var templateGenerator = Handlebars.compile( $("#template-generator").html() ); | ||
var templateProject = Handlebars.compile( $("#template-project").html() ); | ||
var templateSections = Handlebars.compile( $("#template-sections").html() ); | ||
var templateSidenav = Handlebars.compile( $("#template-sidenav").html() ); | ||
/** | ||
* Templates. | ||
*/ | ||
var templateHeader = Handlebars.compile( $('#template-header').html() ); | ||
var templateFooter = Handlebars.compile( $('#template-footer').html() ); | ||
var templateArticle = Handlebars.compile( $('#template-article').html() ); | ||
var templateCompareArticle = Handlebars.compile( $('#template-compare-article').html() ); | ||
var templateGenerator = Handlebars.compile( $('#template-generator').html() ); | ||
var templateProject = Handlebars.compile( $('#template-project').html() ); | ||
var templateSections = Handlebars.compile( $('#template-sections').html() ); | ||
var templateSidenav = Handlebars.compile( $('#template-sidenav').html() ); | ||
/** | ||
* apiProject defaults. | ||
*/ | ||
if( ! apiProject.template) apiProject.template = {}; | ||
if(apiProject.template.withCompare == null) apiProject.template.withCompare = true; | ||
if(apiProject.template.withGenerator == null) apiProject.template.withGenerator = true; | ||
/** | ||
* apiProject defaults. | ||
*/ | ||
if ( ! apiProject.template) | ||
apiProject.template = {}; | ||
/** | ||
* Data transform. | ||
*/ | ||
// Grouped by group | ||
var apiByGroup = _.groupBy(api, function(entry) { | ||
return entry.group; | ||
}); | ||
if (apiProject.template.withCompare == null) | ||
apiProject.template.withCompare = true; | ||
// Grouped by group and name | ||
var apiByGroupAndName = {}; | ||
$.each(apiByGroup, function(index, entries) { | ||
apiByGroupAndName[index] = _.groupBy(entries, function(entry) { | ||
return entry.name; | ||
}); | ||
}); | ||
if (apiProject.template.withGenerator == null) | ||
apiProject.template.withGenerator = true; | ||
/** | ||
* Sort api by group - name - title. | ||
*/ | ||
var newList = []; | ||
var umlauts = { "ä": "ae", "ü": "ue", "ö": "oe", "ß": "ss" }; | ||
$.each(apiByGroupAndName, function(index, groupEntries) { | ||
// get titles from the first entry of group[].name[] (name has versioning) | ||
var titles = {}; | ||
$.each(groupEntries, function(index, entries) { | ||
var title = entries[0].title; | ||
if(title !== undefined) | ||
{ | ||
title.toLowerCase().replace(/[äöüß]/g, function($0) { return umlauts[$0]; }); | ||
titles[title + " #~#" + index] = 1; | ||
} | ||
}); // each | ||
// Sort | ||
var values = Object.keys(titles); | ||
values.sort(); | ||
// Setup jQuery Ajax | ||
$.ajaxSetup(apiProject.template.jQueryAjaxSetup); | ||
// Add single elements to the new list | ||
values.forEach(function(name) { | ||
var values = name.split( "#~#"); | ||
groupEntries[values[1]].forEach(function(entry) { | ||
newList.push(entry); | ||
}); // forEach | ||
}); // forEach | ||
}); // each | ||
// api overwrite with ordered list | ||
api = newList; | ||
/** | ||
* Data transform. | ||
*/ | ||
// Grouped by group | ||
var apiByGroup = _.groupBy(api, function(entry) { | ||
return entry.group; | ||
}); | ||
/** | ||
* Group- and Versionlists. | ||
*/ | ||
var apiGroups = {}; | ||
var apiVersions = {}; | ||
apiVersions[apiProject.version] = 1; | ||
// Grouped by group and name | ||
var apiByGroupAndName = {}; | ||
$.each(apiByGroup, function(index, entries) { | ||
apiByGroupAndName[index] = _.groupBy(entries, function(entry) { | ||
return entry.name; | ||
}); | ||
}); | ||
$.each(api, function(index, entry) { | ||
apiGroups[entry.group] = 1; | ||
apiVersions[entry.version] = 1; | ||
}); | ||
/** | ||
* Sort api by group - name - title. | ||
*/ | ||
var newList = []; | ||
var umlauts = { 'ä': 'ae', 'ü': 'ue', 'ö': 'oe', 'ß': 'ss' }; | ||
$.each(apiByGroupAndName, function(index, groupEntries) { | ||
// get titles from the first entry of group[].name[] (name has versioning) | ||
var titles = {}; | ||
$.each(groupEntries, function(index, entries) { | ||
var title = entries[0].title; | ||
if(title !== undefined) { | ||
title.toLowerCase().replace(/[äöüß]/g, function($0) { return umlauts[$0]; }); | ||
titles[title + ' #~#' + index] = 1; | ||
} | ||
}); | ||
// Sort | ||
var values = Object.keys(titles); | ||
values.sort(); | ||
// Sort. | ||
apiGroups = Object.keys(apiGroups); | ||
apiGroups.sort(); | ||
// Add single elements to the new list | ||
values.forEach(function(name) { | ||
var values = name.split( '#~#'); | ||
groupEntries[values[1]].forEach(function(entry) { | ||
newList.push(entry); | ||
}); | ||
}); | ||
}); | ||
// api overwrite with ordered list | ||
api = newList; | ||
apiVersions = Object.keys(apiVersions); | ||
apiVersions.sort(); | ||
apiVersions.reverse(); | ||
/** | ||
* Group- and Versionlists. | ||
*/ | ||
var apiGroups = {}; | ||
var apiVersions = {}; | ||
apiVersions[apiProject.version] = 1; | ||
/** | ||
* Create Navigationlist. | ||
*/ | ||
var nav = []; | ||
apiGroups.forEach(function(group) { | ||
// Mainmenu-Entry. | ||
nav.push({ | ||
group: group, | ||
isHeader: true, | ||
title: group | ||
}); | ||
$.each(api, function(index, entry) { | ||
apiGroups[entry.group] = 1; | ||
apiVersions[entry.version] = 1; | ||
}); | ||
// Add Submenu. | ||
var oldName = ""; | ||
api.forEach(function(entry) { | ||
if(entry.group === group) | ||
{ | ||
if(oldName !== entry.name) | ||
{ | ||
nav.push({ | ||
title: entry.title, | ||
group: group, | ||
name: entry.name, | ||
type: entry.type, | ||
version: entry.version | ||
}); | ||
} | ||
else | ||
{ | ||
nav.push({ | ||
title: entry.title, | ||
group: group, | ||
hidden: true, | ||
name: entry.name, | ||
type: entry.type, | ||
version: entry.version | ||
}); | ||
} | ||
oldName = entry.name; | ||
} | ||
}); // forEach | ||
}); // forEach | ||
// Sort. | ||
apiGroups = Object.keys(apiGroups); | ||
apiGroups.sort(); | ||
// Mainmenu Header Entry. | ||
if(apiProject.header) { | ||
nav.unshift({ | ||
group: "_", | ||
isHeader: true, | ||
title: (apiProject.header.title == null) ? locale.__("General") : apiProject.header.title, | ||
isFixed: true | ||
}); | ||
} | ||
apiVersions = Object.keys(apiVersions); | ||
apiVersions.sort(); | ||
apiVersions.reverse(); | ||
// Mainmenu Footer Entry. | ||
if(apiProject.footer && apiProject.footer.title != null) { | ||
nav.push({ | ||
group: "_footer", | ||
isHeader: true, | ||
title: apiProject.footer.title, | ||
isFixed: true | ||
}); | ||
} | ||
/** | ||
* Create Navigationlist. | ||
*/ | ||
var nav = []; | ||
apiGroups.forEach(function(group) { | ||
// Mainmenu-Entry. | ||
nav.push({ | ||
group: group, | ||
isHeader: true, | ||
title: group | ||
}); | ||
/** | ||
* Render Pagetitle. | ||
*/ | ||
var title = apiProject.title ? apiProject.title : "apiDoc: " + apiProject.name + " - " + apiProject.version; | ||
$(document).attr("title", title); | ||
// Add Submenu. | ||
var oldName = ''; | ||
api.forEach(function(entry) { | ||
if(entry.group === group) | ||
{ | ||
if(oldName !== entry.name) | ||
{ | ||
nav.push({ | ||
title: entry.title, | ||
group: group, | ||
name: entry.name, | ||
type: entry.type, | ||
version: entry.version | ||
}); | ||
} | ||
else | ||
{ | ||
nav.push({ | ||
title: entry.title, | ||
group: group, | ||
hidden: true, | ||
name: entry.name, | ||
type: entry.type, | ||
version: entry.version | ||
}); | ||
} | ||
oldName = entry.name; | ||
} | ||
}); | ||
}); | ||
/** | ||
* Remove loader. | ||
*/ | ||
$("#loader").remove(); | ||
// Mainmenu Header Entry. | ||
if (apiProject.header) { | ||
nav.unshift({ | ||
group: '_', | ||
isHeader: true, | ||
title: (apiProject.header.title == null) ? locale.__('General') : apiProject.header.title, | ||
isFixed: true | ||
}); | ||
} | ||
/** | ||
* Render Sidenav. | ||
*/ | ||
var fields = { | ||
nav: nav | ||
}; | ||
$("#sidenav").append( templateSidenav(fields) ); | ||
// Mainmenu Footer Entry. | ||
if (apiProject.footer && apiProject.footer.title != null) { | ||
nav.push({ | ||
group: '_footer', | ||
isHeader: true, | ||
title: apiProject.footer.title, | ||
isFixed: true | ||
}); | ||
} | ||
/** | ||
* Render Generator. | ||
*/ | ||
$("#generator").append( templateGenerator(apiProject) ); | ||
/** | ||
* Render Project. | ||
*/ | ||
_.extend(apiProject, { versions: apiVersions}); | ||
$("#project").append( templateProject(apiProject) ); | ||
/** | ||
* Render Pagetitle. | ||
*/ | ||
var title = apiProject.title ? apiProject.title : 'apiDoc: ' + apiProject.name + ' - ' + apiProject.version; | ||
$(document).attr('title', title); | ||
/** | ||
* Render ApiDoc, header/footer documentation. | ||
*/ | ||
if(apiProject.header) $("#header").append( templateHeader(apiProject.header) ); | ||
if(apiProject.footer) $("#footer").append( templateFooter(apiProject.footer) ); | ||
/** | ||
* Remove loader. | ||
*/ | ||
$('#loader').remove(); | ||
/** | ||
* Render Sections and Articles | ||
*/ | ||
var articleVersions = {}; | ||
apiGroups.forEach(function(groupEntry) { | ||
var articles = []; | ||
var oldName = ""; | ||
var fields = {}; | ||
var description = ""; | ||
articleVersions[groupEntry] = {}; | ||
// Render all Articls of a group. | ||
api.forEach(function(entry) { | ||
if(groupEntry === entry.group) | ||
{ | ||
if(oldName !== entry.name) | ||
{ | ||
// Artikelversionen ermitteln. | ||
api.forEach(function(versionEntry) { | ||
if(groupEntry === versionEntry.group && entry.name === versionEntry.name) | ||
{ | ||
if( ! articleVersions[entry.group][entry.name]) articleVersions[entry.group][entry.name] = []; | ||
articleVersions[entry.group][entry.name].push(versionEntry.version); | ||
} | ||
}); | ||
fields = { | ||
article: entry, | ||
versions: articleVersions[entry.group][entry.name] | ||
}; | ||
} | ||
else | ||
{ | ||
fields = { | ||
article: entry, | ||
hidden: true, | ||
versions: articleVersions[entry.group][entry.name] | ||
}; | ||
} | ||
/** | ||
* Render Sidenav. | ||
*/ | ||
var fields = { | ||
nav: nav | ||
}; | ||
$('#sidenav').append( templateSidenav(fields) ); | ||
// Add prefix URL for endpoint | ||
if(apiProject.url) fields.article.url = apiProject.url + fields.article.url; | ||
/** | ||
* Render Generator. | ||
*/ | ||
$('#generator').append( templateGenerator(apiProject) ); | ||
addArticleSettings(fields, entry); | ||
/** | ||
* Render Project. | ||
*/ | ||
_.extend(apiProject, { versions: apiVersions}); | ||
$('#project').append( templateProject(apiProject) ); | ||
// TODO: make groupDescription compareable with older versions (not important for the moment). | ||
if (entry.groupDescription) description = entry.groupDescription; | ||
/** | ||
* Render ApiDoc, header/footer documentation. | ||
*/ | ||
if (apiProject.header) | ||
$('#header').append( templateHeader(apiProject.header) ); | ||
articles.push({ | ||
article: templateArticle(fields), | ||
group: entry.group, | ||
name: entry.name | ||
}); | ||
oldName = entry.name; | ||
} | ||
}); // forEach | ||
if (apiProject.footer) | ||
$('#footer').append( templateFooter(apiProject.footer) ); | ||
// Render Section with Articles. | ||
var fields = { | ||
group: groupEntry, | ||
title: groupEntry, | ||
description: description, | ||
articles: articles | ||
}; | ||
$("#sections").append( templateSections(fields) ); | ||
}); // forEach | ||
/** | ||
* Render Sections and Articles | ||
*/ | ||
var articleVersions = {}; | ||
apiGroups.forEach(function(groupEntry) { | ||
var articles = []; | ||
var oldName = ''; | ||
var fields = {}; | ||
var title = groupEntry; | ||
var description = ''; | ||
articleVersions[groupEntry] = {}; | ||
/** | ||
* Bootstrap Scrollspy. | ||
*/ | ||
var $scrollSpy = $(this).scrollspy({ target: "#scrollingNav", offset: 25 }); | ||
$('[data-spy="scroll"]').each(function () { | ||
$scrollSpy('refresh'); | ||
}); | ||
// Render all Articls of a group. | ||
api.forEach(function(entry) { | ||
if(groupEntry === entry.group) { | ||
if (oldName !== entry.name) { | ||
// determine versions | ||
api.forEach(function(versionEntry) { | ||
if (groupEntry === versionEntry.group && entry.name === versionEntry.name) { | ||
if ( ! articleVersions[entry.group][entry.name]) | ||
articleVersions[entry.group][entry.name] = []; | ||
// Content-Scroll on Navigation click. | ||
$(".sidenav").find("a").on("click", function(e) { | ||
e.preventDefault(); | ||
var id = $(this).attr("href"); | ||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400); | ||
window.location.hash = $(this).attr("href"); | ||
}); | ||
articleVersions[entry.group][entry.name].push(versionEntry.version); | ||
} | ||
}); | ||
fields = { | ||
article: entry, | ||
versions: articleVersions[entry.group][entry.name] | ||
}; | ||
} | ||
else | ||
{ | ||
fields = { | ||
article: entry, | ||
hidden: true, | ||
versions: articleVersions[entry.group][entry.name] | ||
}; | ||
} | ||
// Quickjump on Pageload to hash position. | ||
if(window.location.hash) | ||
{ | ||
var id = window.location.hash; | ||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 0); | ||
} | ||
// Add prefix URL for endpoint | ||
if (apiProject.url) | ||
fields.article.url = apiProject.url + fields.article.url; | ||
/** | ||
* Check if Parameter (sub) List has a type Field. | ||
* Example: @apaSuccess varname1 No type. | ||
* @apaSuccess {String} varname2 With type. | ||
* | ||
* @param {Object} fields | ||
*/ | ||
function _hasTypeInFields(fields) | ||
{ | ||
hasField = false; | ||
$.each(fields, function(name) { | ||
if(_.any(fields[name], function(item) { return item.type; }) ) | ||
{ | ||
hasField = true; | ||
} | ||
}); | ||
return hasField; | ||
} // _hasTypeInFields | ||
addArticleSettings(fields, entry); | ||
/** | ||
* On Template changes, recall plugins. | ||
*/ | ||
function initDynamic() | ||
{ | ||
// Bootstrap Popover. | ||
$("a[data-toggle=popover]") | ||
.popover() | ||
.click(function(e) { | ||
e.preventDefault(); | ||
}) | ||
; | ||
if (entry.groupTitle) | ||
title = entry.groupTitle; | ||
var version = $("#version strong").html(); | ||
$("#sidenav li").removeClass("is-new"); | ||
if(apiProject.template.withCompare) | ||
{ | ||
$("#sidenav li[data-version=\"" + version + "\"]").each(function(){ | ||
var group = $(this).data("group"); | ||
var name = $(this).data("name"); | ||
var length = $("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"]").length; | ||
var index = $("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"]").index($(this)); | ||
if(length === 1 || index === (length - 1)) | ||
{ | ||
$(this).addClass("is-new"); | ||
} | ||
}); | ||
} | ||
// Tabs | ||
$('.nav-tabs-examples a').click(function (e) { | ||
e.preventDefault(); | ||
$(this).tab('show'); | ||
}); | ||
// TODO: check to remove this silly timeout problem, tabs not activate but it is rendered | ||
//setTimeout(function() { | ||
$('.nav-tabs-examples').find('a:first').tab('show'); | ||
//}, 10); | ||
// TODO: make groupDescription compareable with older versions (not important for the moment). | ||
if (entry.groupDescription) | ||
description = entry.groupDescription; | ||
/** | ||
* Init Modules | ||
*/ | ||
sampleRequest.initDynamic(); | ||
} // initDynamic | ||
initDynamic(); | ||
articles.push({ | ||
article: templateArticle(fields), | ||
group: entry.group, | ||
name: entry.name | ||
}); | ||
oldName = entry.name; | ||
} | ||
}); | ||
/** | ||
* Pre- / Code-Format. | ||
*/ | ||
prettyPrint(); | ||
/** | ||
* HTML-Template specific jQuery-Functions | ||
*/ | ||
// Change Main Version | ||
$("#versions li.version a").on("click", function(e) { | ||
e.preventDefault(); | ||
// Render Section with Articles. | ||
var fields = { | ||
group: groupEntry, | ||
title: title, | ||
description: description, | ||
articles: articles | ||
}; | ||
$('#sections').append( templateSections(fields) ); | ||
}); | ||
var selectedVersion = $(this).html(); | ||
$("#version strong").html(selectedVersion); | ||
// Bootstrap Scrollspy | ||
var $scrollSpy = $(this).scrollspy({ target: '#scrollingNav', offset: 25 }); | ||
$('[data-spy="scroll"]').each(function () { | ||
$scrollSpy('refresh'); | ||
}); | ||
// Hide all | ||
$("article").addClass("hide"); | ||
$("#sidenav li:not(.nav-fixed)").addClass("hide"); | ||
// Content-Scroll on Navigation click. | ||
$('.sidenav').find('a').on('click', function(e) { | ||
e.preventDefault(); | ||
var id = $(this).attr('href'); | ||
if ($(id).length > 0) | ||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 400); | ||
window.location.hash = $(this).attr('href'); | ||
}); | ||
// Show 1st equal or lower Version of each entry | ||
$("article[data-version]").each(function(index) { | ||
var group = $(this).data("group"); | ||
var name = $(this).data("name"); | ||
var version = $(this).data("version"); | ||
if(version <= selectedVersion) | ||
{ | ||
if($("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"]:visible").length === 0) | ||
{ | ||
// Enable Article | ||
$("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + version + "\"]").removeClass("hide"); | ||
// Enable Navigation | ||
$("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + version + "\"]").removeClass("hide"); | ||
$("#sidenav li.nav-header[data-group=\"" + group + "\"]").removeClass("hide"); | ||
} | ||
} | ||
}); | ||
initDynamic(); | ||
return; | ||
}); | ||
// Quickjump on Pageload to hash position. | ||
if(window.location.hash) { | ||
var id = window.location.hash; | ||
if ($(id).length > 0) | ||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) }, 0); | ||
} | ||
// On click compare all currently selected Versions with their predecessor. | ||
$("#compareAllWithPredecessor").on("click", changeAllVersionCompareTo); | ||
/** | ||
* Check if Parameter (sub) List has a type Field. | ||
* Example: @apaSuccess varname1 No type. | ||
* @apaSuccess {String} varname2 With type. | ||
* | ||
* @param {Object} fields | ||
*/ | ||
function _hasTypeInFields(fields) { | ||
hasField = false; | ||
$.each(fields, function(name) { | ||
if (_.any(fields[name], function(item) { return item.type; }) ) | ||
hasField = true; | ||
}); | ||
return hasField; | ||
} | ||
// On change the Version of an article. | ||
$("article .versions li.version a").on("click", changeVersionCompareTo); | ||
/** | ||
* On Template changes, recall plugins. | ||
*/ | ||
function initDynamic() | ||
{ | ||
// bootstrap Popover | ||
$('a[data-toggle=popover]') | ||
.popover() | ||
.click(function(e) { | ||
e.preventDefault(); | ||
}) | ||
; | ||
$.urlParam = function(name) { | ||
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); | ||
return (results && results[1]) ? results[1] : null; | ||
}; | ||
var version = $('#version strong').html(); | ||
$('#sidenav li').removeClass('is-new'); | ||
if(apiProject.template.withCompare) { | ||
$('#sidenav li[data-version=\'' + version + '\']').each(function(){ | ||
var group = $(this).data('group'); | ||
var name = $(this).data('name'); | ||
var length = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').length; | ||
var index = $('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\']').index($(this)); | ||
if (length === 1 || index === (length - 1)) | ||
$(this).addClass('is-new'); | ||
}); | ||
} | ||
if($.urlParam("compare")) | ||
{ | ||
// URL Paramter ?compare=1 is set. | ||
$("#compareAllWithPredecessor").trigger("click"); | ||
// Tabs | ||
$('.nav-tabs-examples a').click(function (e) { | ||
e.preventDefault(); | ||
$(this).tab('show'); | ||
}); | ||
$('.nav-tabs-examples').find('a:first').tab('show'); | ||
if(window.location.hash) | ||
{ | ||
var id = window.location.hash; | ||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 0); | ||
} | ||
} | ||
// Sample Request Switch | ||
$('.sample-request-switch').click(function (e) { | ||
var name = '.' + $(this).attr('name') + '-fields'; | ||
$(name).addClass('hide'); | ||
$(this).parent().next(name).removeClass('hide'); | ||
}); | ||
/** | ||
* | ||
*/ | ||
function changeVersionCompareTo(e) | ||
{ | ||
e.preventDefault(); | ||
// Init Modules | ||
sampleRequest.initDynamic(); | ||
} | ||
initDynamic(); | ||
var $root = $(this).parents("article"); | ||
var selectedVersion = $(this).html(); | ||
var $button = $root.find(".version"); | ||
var currentVersion = $button.find("strong").html(); | ||
$button.find("strong").html(selectedVersion); | ||
var group = $root.data("group"); | ||
var name = $root.data("name"); | ||
var version = $root.data("version"); | ||
var compareVersion = $root.data("compare-version"); | ||
/** | ||
* Pre- / Code-Format. | ||
*/ | ||
prettyPrint(); | ||
if(compareVersion === selectedVersion) return; | ||
if( ! compareVersion && version == selectedVersion) return; | ||
if( compareVersion && articleVersions[group][name][0] === selectedVersion | ||
|| version === selectedVersion | ||
) | ||
{ | ||
// Version des Eintrages wurde wieder auf höchste Version gesetzt (reset) | ||
resetArticle(group, name, version); | ||
} | ||
else | ||
{ | ||
var $compareToArticle = $("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + selectedVersion + "\"]"); | ||
/** | ||
* HTML-Template specific jQuery-Functions | ||
*/ | ||
// Change Main Version | ||
$('#versions li.version a').on('click', function(e) { | ||
e.preventDefault(); | ||
var sourceEntry = {}; | ||
var compareEntry = {}; | ||
$.each(apiByGroupAndName[group][name], function(index, entry) { | ||
if(entry.version === version) sourceEntry = entry; | ||
if(entry.version === selectedVersion) compareEntry = entry; | ||
}); | ||
var selectedVersion = $(this).html(); | ||
$('#version strong').html(selectedVersion); | ||
var fields = { | ||
article: sourceEntry, | ||
compare: compareEntry, | ||
versions: articleVersions[group][name] | ||
}; | ||
// Hide all | ||
$('article').addClass('hide'); | ||
$('#sidenav li:not(.nav-fixed)').addClass('hide'); | ||
// Add unique id | ||
// TODO: replace all group-name-version in template with id. | ||
fields.article.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; | ||
fields.article.id = fields.article.id.replace(/\./g, '_'); | ||
// Show 1st equal or lower Version of each entry | ||
$('article[data-version]').each(function(index) { | ||
var group = $(this).data('group'); | ||
var name = $(this).data('name'); | ||
var version = $(this).data('version'); | ||
fields.compare.id = fields.compare.group + '-' + fields.compare.name + '-' + fields.compare.version; | ||
fields.compare.id = fields.compare.id.replace(/\./g, '_'); | ||
if (version <= selectedVersion) { | ||
if($('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible').length === 0) { | ||
// Enable Article | ||
$('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); | ||
// Enable Navigation | ||
$('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); | ||
$('#sidenav li.nav-header[data-group=\'' + group + '\']').removeClass('hide'); | ||
} | ||
} | ||
}); | ||
var entry = sourceEntry; | ||
if(entry.parameter && entry.parameter.fields) fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); | ||
if(entry.error && entry.error.fields) fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); | ||
if(entry.success && entry.success.fields) fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); | ||
if(entry.info && entry.info.fields) fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); | ||
initDynamic(); | ||
return; | ||
}); | ||
var entry = compareEntry; | ||
if(fields._hasTypeInParameterFields !== true && entry.parameter && entry.parameter.fields) fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); | ||
if(fields._hasTypeInErrorFields !== true && entry.error && entry.error.fields) fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); | ||
if(fields._hasTypeInSuccessFields !== true && entry.success && entry.success.fields) fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); | ||
if(fields._hasTypeInInfoFields !== true && entry.info && entry.info.fields) fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); | ||
// On click compare all currently selected Versions with their predecessor. | ||
$('#compareAllWithPredecessor').on('click', changeAllVersionCompareTo); | ||
var content = templateCompareArticle(fields); | ||
$root.after(content); | ||
var $content = $root.next(); | ||
// On change the Version of an article. | ||
$('article .versions li.version a').on('click', changeVersionCompareTo); | ||
// Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte) | ||
$content.find(".versions li.version a").on("click", changeVersionCompareTo); | ||
// Navigation markieren | ||
$("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + currentVersion + "\"]").addClass("has-modifications"); | ||
$.urlParam = function(name) { | ||
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); | ||
return (results && results[1]) ? results[1] : null; | ||
}; | ||
$root.remove(); | ||
// todo: bei Hauptversionswechsel oder zurückstellen auf höchste Eintragsversion, den Eintrag neu rendern | ||
} | ||
if($.urlParam('compare')) { | ||
// URL Paramter ?compare=1 is set. | ||
$('#compareAllWithPredecessor').trigger('click'); | ||
initDynamic(); | ||
return; | ||
} // changeVersionCompareTo | ||
if (window.location.hash) { | ||
var id = window.location.hash; | ||
$('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 0); | ||
} | ||
} | ||
/** | ||
* | ||
*/ | ||
function changeAllVersionCompareTo(e) | ||
{ | ||
e.preventDefault(); | ||
$("article:visible .versions").each(function(){ | ||
var $root = $(this).parents("article"); | ||
var currentVersion = $root.data("version"); | ||
var $foundElement = null; | ||
$(this).find("li.version a").each(function() { | ||
var selectVersion = $(this).html(); | ||
if(selectVersion < currentVersion && ! $foundElement) | ||
{ | ||
$foundElement = $(this); | ||
} | ||
}); | ||
if($foundElement) | ||
{ | ||
$foundElement.trigger("click"); | ||
} | ||
}); | ||
/** | ||
* | ||
*/ | ||
function changeVersionCompareTo(e) { | ||
e.preventDefault(); | ||
initDynamic(); | ||
return; | ||
} // changeAllVersionCompareTo | ||
var $root = $(this).parents('article'); | ||
var selectedVersion = $(this).html(); | ||
var $button = $root.find('.version'); | ||
var currentVersion = $button.find('strong').html(); | ||
$button.find('strong').html(selectedVersion); | ||
/** | ||
* Add article settings. | ||
*/ | ||
function addArticleSettings(fields, entry) | ||
{ | ||
// Add unique id | ||
// TODO: replace all group-name-version in template with id. | ||
fields.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; | ||
fields.id = fields.id.replace(/\./g, '_'); | ||
var group = $root.data('group'); | ||
var name = $root.data('name'); | ||
var version = $root.data('version'); | ||
if(entry.header && entry.header.fields) fields._hasTypeInHeaderFields = _hasTypeInFields(entry.header.fields); | ||
if(entry.parameter && entry.parameter.fields) fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); | ||
if(entry.error && entry.error.fields) fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); | ||
if(entry.success && entry.success.fields) fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); | ||
if(entry.info && entry.info.fields) fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); | ||
var compareVersion = $root.data('compare-version'); | ||
// Add template settings | ||
fields.template = apiProject.template; | ||
} // addArticleSettings | ||
if (compareVersion === selectedVersion) | ||
return; | ||
/** | ||
* Render an Article. | ||
*/ | ||
function renderArticle(group, name, version) | ||
{ | ||
var entry = {}; | ||
$.each(apiByGroupAndName[group][name], function(index, currentEntry) { | ||
if(currentEntry.version === version) entry = currentEntry; | ||
}); | ||
var fields = { | ||
article: entry, | ||
versions: articleVersions[group][name] | ||
}; | ||
if ( ! compareVersion && version == selectedVersion) | ||
return; | ||
addArticleSettings(fields, entry); | ||
if (compareVersion && articleVersions[group][name][0] === selectedVersion || version === selectedVersion) { | ||
// Version des Eintrages wurde wieder auf höchste Version gesetzt (reset) | ||
resetArticle(group, name, version); | ||
} else { | ||
var $compareToArticle = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + selectedVersion + '\']'); | ||
return templateArticle(fields); | ||
} // renderArticle | ||
var sourceEntry = {}; | ||
var compareEntry = {}; | ||
$.each(apiByGroupAndName[group][name], function(index, entry) { | ||
if (entry.version === version) | ||
sourceEntry = entry; | ||
if (entry.version === selectedVersion) | ||
compareEntry = entry; | ||
}); | ||
/** | ||
* Render the original Article and remove the current visible Article. | ||
*/ | ||
function resetArticle(group, name, version) | ||
{ | ||
var $root = $("article[data-group=\"" + group + "\"][data-name=\"" + name + "\"]:visible"); | ||
var content = renderArticle(group, name, version); | ||
var fields = { | ||
article: sourceEntry, | ||
compare: compareEntry, | ||
versions: articleVersions[group][name] | ||
}; | ||
$root.after(content); | ||
var $content = $root.next(); | ||
// Add unique id | ||
// TODO: replace all group-name-version in template with id. | ||
fields.article.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; | ||
fields.article.id = fields.article.id.replace(/\./g, '_'); | ||
// Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte) | ||
$content.find(".versions li.version a").on("click", changeVersionCompareTo); | ||
fields.compare.id = fields.compare.group + '-' + fields.compare.name + '-' + fields.compare.version; | ||
fields.compare.id = fields.compare.id.replace(/\./g, '_'); | ||
$("#sidenav li[data-group=\"" + group + "\"][data-name=\"" + name + "\"][data-version=\"" + version + "\"]").removeClass("has-modifications"); | ||
$root.remove(); | ||
return; | ||
} // resetArticle | ||
var entry = sourceEntry; | ||
if (entry.parameter && entry.parameter.fields) | ||
fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); | ||
function loadGoogleFontCss($){ | ||
var host = document.location.hostname.toLowerCase(); | ||
var protocol = document.location.protocol.toLowerCase(); | ||
var googleCss = '//fonts.googleapis.com/css?family=Source+Code+Pro|Source+Sans+Pro:400,600,700'; | ||
if (host == "localhost" || !host.length || protocol === 'file:'){ | ||
googleCss = 'http:' + googleCss; | ||
} | ||
$("<link/>", { | ||
rel: "stylesheet", | ||
type: "text/css", | ||
href: googleCss | ||
}).appendTo("head"); | ||
} // loadGoogleFontCss | ||
if (entry.error && entry.error.fields) | ||
fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); | ||
if (entry.success && entry.success.fields) | ||
fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); | ||
if (entry.info && entry.info.fields) | ||
fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); | ||
var entry = compareEntry; | ||
if (fields._hasTypeInParameterFields !== true && entry.parameter && entry.parameter.fields) | ||
fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); | ||
if (fields._hasTypeInErrorFields !== true && entry.error && entry.error.fields) | ||
fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); | ||
if (fields._hasTypeInSuccessFields !== true && entry.success && entry.success.fields) | ||
fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); | ||
if (fields._hasTypeInInfoFields !== true && entry.info && entry.info.fields) | ||
fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); | ||
var content = templateCompareArticle(fields); | ||
$root.after(content); | ||
var $content = $root.next(); | ||
// Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte) | ||
$content.find('.versions li.version a').on('click', changeVersionCompareTo); | ||
// Navigation markieren | ||
$('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + currentVersion + '\']').addClass('has-modifications'); | ||
$root.remove(); | ||
// todo: bei Hauptversionswechsel oder zurückstellen auf höchste Eintragsversion, den Eintrag neu rendern | ||
} | ||
initDynamic(); | ||
} | ||
/** | ||
* | ||
*/ | ||
function changeAllVersionCompareTo(e) { | ||
e.preventDefault(); | ||
$('article:visible .versions').each(function(){ | ||
var $root = $(this).parents('article'); | ||
var currentVersion = $root.data('version'); | ||
var $foundElement = null; | ||
$(this).find('li.version a').each(function() { | ||
var selectVersion = $(this).html(); | ||
if (selectVersion < currentVersion && ! $foundElement) | ||
$foundElement = $(this); | ||
}); | ||
if($foundElement) | ||
$foundElement.trigger('click'); | ||
}); | ||
initDynamic(); | ||
} // changeAllVersionCompareTo | ||
/** | ||
* Add article settings. | ||
*/ | ||
function addArticleSettings(fields, entry) { | ||
// Add unique id | ||
// TODO: replace all group-name-version in template with id. | ||
fields.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; | ||
fields.id = fields.id.replace(/\./g, '_'); | ||
if (entry.header && entry.header.fields) | ||
fields._hasTypeInHeaderFields = _hasTypeInFields(entry.header.fields); | ||
if (entry.parameter && entry.parameter.fields) | ||
fields._hasTypeInParameterFields = _hasTypeInFields(entry.parameter.fields); | ||
if (entry.error && entry.error.fields) | ||
fields._hasTypeInErrorFields = _hasTypeInFields(entry.error.fields); | ||
if (entry.success && entry.success.fields) | ||
fields._hasTypeInSuccessFields = _hasTypeInFields(entry.success.fields); | ||
if (entry.info && entry.info.fields) | ||
fields._hasTypeInInfoFields = _hasTypeInFields(entry.info.fields); | ||
// Add template settings | ||
fields.template = apiProject.template; | ||
} | ||
/** | ||
* Render an Article. | ||
*/ | ||
function renderArticle(group, name, version) { | ||
var entry = {}; | ||
$.each(apiByGroupAndName[group][name], function(index, currentEntry) { | ||
if (currentEntry.version === version) | ||
entry = currentEntry; | ||
}); | ||
var fields = { | ||
article: entry, | ||
versions: articleVersions[group][name] | ||
}; | ||
addArticleSettings(fields, entry); | ||
return templateArticle(fields); | ||
} | ||
/** | ||
* Render the original Article and remove the current visible Article. | ||
*/ | ||
function resetArticle(group, name, version) { | ||
var $root = $('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible'); | ||
var content = renderArticle(group, name, version); | ||
$root.after(content); | ||
var $content = $root.next(); | ||
// Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte) | ||
$content.find('.versions li.version a').on('click', changeVersionCompareTo); | ||
$('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('has-modifications'); | ||
$root.remove(); | ||
return; | ||
} | ||
function loadGoogleFontCss($) { | ||
var host = document.location.hostname.toLowerCase(); | ||
var protocol = document.location.protocol.toLowerCase(); | ||
var googleCss = '//fonts.googleapis.com/css?family=Source+Code+Pro|Source+Sans+Pro:400,600,700'; | ||
if (host == 'localhost' || !host.length || protocol === 'file:') | ||
googleCss = 'http:' + googleCss; | ||
$('<link/>', { | ||
rel: 'stylesheet', | ||
type: 'text/css', | ||
href: googleCss | ||
}).appendTo('head'); | ||
} | ||
}); |
define([ | ||
'jquery' | ||
], function($) { | ||
var initDynamic = function() { | ||
@@ -16,3 +16,3 @@ // Button send | ||
}); | ||
// Button clear | ||
@@ -29,3 +29,3 @@ $(".sample-request-clear").off("click"); | ||
}; // initDynamic | ||
function sendSampleRequest(group, name, version, type) | ||
@@ -35,8 +35,22 @@ { | ||
// Optional header | ||
var header = {}; | ||
$root.find(".sample-request-header:checked").each(function(i, element) { | ||
var group = $(element).data("sample-request-header-group-id"); | ||
$root.find("[data-sample-request-header-group=\"" + group + "\"]").each(function(i, element) { | ||
var key = $(element).data("sample-request-header-name"); | ||
var value = element.value; | ||
header[key] = $.type(value) === "string" ? escapeHtml(value) : value; | ||
}); | ||
}); | ||
// create JSON dictionary of parameters | ||
var dict = {}; | ||
$root.find(".sample-request-param").each(function(i, element) { | ||
var key = $(element).data("name"); | ||
var value = element.value; | ||
dict[key] = $.type(value) === "string" ? escapeHtml(value) : value; | ||
var param = {}; | ||
$root.find(".sample-request-param:checked").each(function(i, element) { | ||
var group = $(element).data("sample-request-param-group-id"); | ||
$root.find("[data-sample-request-param-group=\"" + group + "\"]").each(function(i, element) { | ||
var key = $(element).data("sample-request-param-name"); | ||
var value = element.value; | ||
param[key] = $.type(value) === "string" ? escapeHtml(value) : value; | ||
}); | ||
}); | ||
@@ -48,13 +62,13 @@ | ||
// Insert url parameter | ||
// @todo Better use a library like https://github.com/component/path-to-regexp | ||
var pattern = /\:(?!\/)(.*?)(\/|$)/g; | ||
var matches; | ||
while ((matches = pattern.exec(url)) !== null) | ||
{ | ||
var key = matches[1]; | ||
if (dict[key] !== undefined) { | ||
url = url.replace(matches[0], encodeURIComponent(dict[key])); | ||
delete dict[key]; | ||
var pattern = pathtoRegexp(url, null); | ||
var matches = pattern.exec(url); | ||
for (var i = 1; i < matches.length; i++) { | ||
var key = matches[i].substr(1); | ||
if (param[key] !== undefined) { | ||
url = url.replace(matches[i], encodeURIComponent(param[key])); | ||
// remove URL parameters from list | ||
delete param[key]; | ||
} | ||
} // while | ||
} // for | ||
@@ -65,3 +79,5 @@ // send AJAX request, catch success or error callback | ||
dataType: "json", | ||
data: dict, | ||
contentType: "application/json", | ||
data: param, | ||
headers: header, | ||
type: type.toUpperCase(), | ||
@@ -73,4 +89,10 @@ success: displaySuccess, | ||
function displaySuccess(data) { | ||
$root.find(".sample-request-response").show(); | ||
$root.find(".sample-request-response-json").html(JSON.stringify(data, null, 4)); | ||
var jsonResponse; | ||
try { | ||
jsonResponse = JSON.stringify(data, null, 4); | ||
} catch (e) { | ||
jsonResponse = data; | ||
} | ||
$root.find(".sample-request-response").fadeTo(250, 1); | ||
$root.find(".sample-request-response-json").html(jsonResponse); | ||
refreshScrollSpy(); | ||
@@ -80,12 +102,28 @@ }; | ||
function displayError(jqXHR, textStatus, error) { | ||
$root.find(".sample-request-response").show(); | ||
$root.find(".sample-request-response-json").html(jqXHR.status + " Error: " + error); | ||
var message = "Error " + jqXHR.status + ": " + error; | ||
var jsonResponse; | ||
try { | ||
jsonResponse = JSON.parse(jqXHR.responseText); | ||
jsonResponse = JSON.stringify(jsonResponse, null, 4); | ||
} catch (e) { | ||
jsonResponse = jqXHR.responseText; | ||
} | ||
if (jsonResponse) | ||
message += "<br>" + jsonResponse; | ||
// flicker on previous error to make clear that there is a new response | ||
if($root.find(".sample-request-response").is(":visible")) | ||
$root.find(".sample-request-response").fadeTo(1, 0.1); | ||
$root.find(".sample-request-response").fadeTo(250, 1); | ||
$root.find(".sample-request-response-json").html(message); | ||
refreshScrollSpy(); | ||
}; | ||
} | ||
function clearSampleRequest(group, name, version) | ||
{ | ||
var $root = $('article[data-group="' + group + '"][data-name="' + name + '"][data-version="' + version + '"]'); | ||
// hide sample response | ||
@@ -101,8 +139,8 @@ $root.find(".sample-request-response-json").html(""); | ||
// restore default URL | ||
var $uRLelement = $root.find(".sample-request-url"); | ||
$uRLelement.val($uRLelement.prop("defaultValue")); | ||
var $urlElement = $root.find(".sample-request-url"); | ||
$urlElement.val($urlElement.prop("defaultValue")); | ||
refreshScrollSpy(); | ||
} | ||
function refreshScrollSpy() | ||
@@ -112,3 +150,3 @@ { | ||
$(this).scrollspy("refresh"); | ||
}); | ||
}); | ||
} | ||
@@ -121,3 +159,3 @@ | ||
} | ||
/** | ||
@@ -124,0 +162,0 @@ * Exports. |
/*! | ||
handlebars v1.3.0 | ||
handlebars v2.0.0 | ||
Copyright (C) 2011 by Yehuda Katz | ||
Copyright (C) 2011-2014 by Yehuda Katz | ||
@@ -27,2 +27,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy | ||
*/ | ||
var Handlebars=function(){var e=function(){"use strict";function t(e){this.string=e}var e;t.prototype.toString=function(){return""+this.string};e=t;return e}();var t=function(e){"use strict";function o(e){return r[e]||"&"}function u(e,t){for(var n in t){if(Object.prototype.hasOwnProperty.call(t,n)){e[n]=t[n]}}}function c(e){if(e instanceof n){return e.toString()}else if(!e&&e!==0){return""}e=""+e;if(!s.test(e)){return e}return e.replace(i,o)}function h(e){if(!e&&e!==0){return true}else if(l(e)&&e.length===0){return true}else{return false}}var t={};var n=e;var r={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"};var i=/[&<>"'`]/g;var s=/[&<>"'`]/;t.extend=u;var a=Object.prototype.toString;t.toString=a;var f=function(e){return typeof e==="function"};if(f(/x/)){f=function(e){return typeof e==="function"&&a.call(e)==="[object Function]"}}var f;t.isFunction=f;var l=Array.isArray||function(e){return e&&typeof e==="object"?a.call(e)==="[object Array]":false};t.isArray=l;t.escapeExpression=c;t.isEmpty=h;return t}(e);var n=function(){"use strict";function n(e,n){var r;if(n&&n.firstLine){r=n.firstLine;e+=" - "+r+":"+n.firstColumn}var i=Error.prototype.constructor.call(this,e);for(var s=0;s<t.length;s++){this[t[s]]=i[t[s]]}if(r){this.lineNumber=r;this.column=n.firstColumn}}var e;var t=["description","fileName","lineNumber","message","name","number","stack"];n.prototype=new Error;e=n;return e}();var r=function(e,t){"use strict";function h(e,t){this.helpers=e||{};this.partials=t||{};p(this)}function p(e){e.registerHelper("helperMissing",function(e){if(arguments.length===2){return undefined}else{throw new i("Missing helper: '"+e+"'")}});e.registerHelper("blockHelperMissing",function(t,n){var r=n.inverse||function(){},i=n.fn;if(f(t)){t=t.call(this)}if(t===true){return i(this)}else if(t===false||t==null){return r(this)}else if(a(t)){if(t.length>0){return e.helpers.each(t,n)}else{return r(this)}}else{return i(t)}});e.registerHelper("each",function(e,t){var n=t.fn,r=t.inverse;var i=0,s="",o;if(f(e)){e=e.call(this)}if(t.data){o=m(t.data)}if(e&&typeof e==="object"){if(a(e)){for(var u=e.length;i<u;i++){if(o){o.index=i;o.first=i===0;o.last=i===e.length-1}s=s+n(e[i],{data:o})}}else{for(var l in e){if(e.hasOwnProperty(l)){if(o){o.key=l;o.index=i;o.first=i===0}s=s+n(e[l],{data:o});i++}}}}if(i===0){s=r(this)}return s});e.registerHelper("if",function(e,t){if(f(e)){e=e.call(this)}if(!t.hash.includeZero&&!e||r.isEmpty(e)){return t.inverse(this)}else{return t.fn(this)}});e.registerHelper("unless",function(t,n){return e.helpers["if"].call(this,t,{fn:n.inverse,inverse:n.fn,hash:n.hash})});e.registerHelper("with",function(e,t){if(f(e)){e=e.call(this)}if(!r.isEmpty(e))return t.fn(e)});e.registerHelper("log",function(t,n){var r=n.data&&n.data.level!=null?parseInt(n.data.level,10):1;e.log(r,t)})}function v(e,t){d.log(e,t)}var n={};var r=e;var i=t;var s="1.3.0";n.VERSION=s;var o=4;n.COMPILER_REVISION=o;var u={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"};n.REVISION_CHANGES=u;var a=r.isArray,f=r.isFunction,l=r.toString,c="[object Object]";n.HandlebarsEnvironment=h;h.prototype={constructor:h,logger:d,log:v,registerHelper:function(e,t,n){if(l.call(e)===c){if(n||t){throw new i("Arg not supported with multiple helpers")}r.extend(this.helpers,e)}else{if(n){t.not=n}this.helpers[e]=t}},registerPartial:function(e,t){if(l.call(e)===c){r.extend(this.partials,e)}else{this.partials[e]=t}}};var d={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(e,t){if(d.level<=e){var n=d.methodMap[e];if(typeof console!=="undefined"&&console[n]){console[n].call(console,t)}}}};n.logger=d;n.log=v;var m=function(e){var t={};r.extend(t,e);return t};n.createFrame=m;return n}(t,n);var i=function(e,t,n){"use strict";function a(e){var t=e&&e[0]||1,n=o;if(t!==n){if(t<n){var r=u[n],i=u[t];throw new s("Template was precompiled with an older version of Handlebars than the current runtime. "+"Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+i+").")}else{throw new s("Template was precompiled with a newer version of Handlebars than the current runtime. "+"Please update your runtime to a newer version ("+e[1]+").")}}}function f(e,t){if(!t){throw new s("No environment passed to template")}var n=function(e,n,r,i,o,u){var a=t.VM.invokePartial.apply(this,arguments);if(a!=null){return a}if(t.compile){var f={helpers:i,partials:o,data:u};o[n]=t.compile(e,{data:u!==undefined},t);return o[n](r,f)}else{throw new s("The partial "+n+" could not be compiled when running in runtime-only mode")}};var r={escapeExpression:i.escapeExpression,invokePartial:n,programs:[],program:function(e,t,n){var r=this.programs[e];if(n){r=c(e,t,n)}else if(!r){r=this.programs[e]=c(e,t)}return r},merge:function(e,t){var n=e||t;if(e&&t&&e!==t){n={};i.extend(n,t);i.extend(n,e)}return n},programWithDepth:t.VM.programWithDepth,noop:t.VM.noop,compilerInfo:null};return function(n,i){i=i||{};var s=i.partial?i:t,o,u;if(!i.partial){o=i.helpers;u=i.partials}var a=e.call(r,s,n,o,u,i.data);if(!i.partial){t.VM.checkRevision(r.compilerInfo)}return a}}function l(e,t,n){var r=Array.prototype.slice.call(arguments,3);var i=function(e,i){i=i||{};return t.apply(this,[e,i.data||n].concat(r))};i.program=e;i.depth=r.length;return i}function c(e,t,n){var r=function(e,r){r=r||{};return t(e,r.data||n)};r.program=e;r.depth=0;return r}function h(e,t,n,r,i,o){var u={partial:true,helpers:r,partials:i,data:o};if(e===undefined){throw new s("The partial "+t+" could not be found")}else if(e instanceof Function){return e(n,u)}}function p(){return""}var r={};var i=e;var s=t;var o=n.COMPILER_REVISION;var u=n.REVISION_CHANGES;r.checkRevision=a;r.template=f;r.programWithDepth=l;r.program=c;r.invokePartial=h;r.noop=p;return r}(t,n,r);var s=function(e,t,n,r,i){"use strict";var s;var o=e;var u=t;var a=n;var f=r;var l=i;var c=function(){var e=new o.HandlebarsEnvironment;f.extend(e,o);e.SafeString=u;e.Exception=a;e.Utils=f;e.VM=l;e.template=function(t){return l.template(t,e)};return e};var h=c();h.create=c;s=h;return s}(r,e,n,t,i);var o=function(e){"use strict";function r(e){e=e||{};this.firstLine=e.first_line;this.firstColumn=e.first_column;this.lastColumn=e.last_column;this.lastLine=e.last_line}var t;var n=e;var i={ProgramNode:function(e,t,n,s){var o,u;if(arguments.length===3){s=n;n=null}else if(arguments.length===2){s=t;t=null}r.call(this,s);this.type="program";this.statements=e;this.strip={};if(n){u=n[0];if(u){o={first_line:u.firstLine,last_line:u.lastLine,last_column:u.lastColumn,first_column:u.firstColumn};this.inverse=new i.ProgramNode(n,t,o)}else{this.inverse=new i.ProgramNode(n,t)}this.strip.right=t.left}else if(t){this.strip.left=t.right}},MustacheNode:function(e,t,n,s,o){r.call(this,o);this.type="mustache";this.strip=s;if(n!=null&&n.charAt){var u=n.charAt(3)||n.charAt(2);this.escaped=u!=="{"&&u!=="&"}else{this.escaped=!!n}if(e instanceof i.SexprNode){this.sexpr=e}else{this.sexpr=new i.SexprNode(e,t)}this.sexpr.isRoot=true;this.id=this.sexpr.id;this.params=this.sexpr.params;this.hash=this.sexpr.hash;this.eligibleHelper=this.sexpr.eligibleHelper;this.isHelper=this.sexpr.isHelper},SexprNode:function(e,t,n){r.call(this,n);this.type="sexpr";this.hash=t;var i=this.id=e[0];var s=this.params=e.slice(1);var o=this.eligibleHelper=i.isSimple;this.isHelper=o&&(s.length||t)},PartialNode:function(e,t,n,i){r.call(this,i);this.type="partial";this.partialName=e;this.context=t;this.strip=n},BlockNode:function(e,t,i,s,o){r.call(this,o);if(e.sexpr.id.original!==s.path.original){throw new n(e.sexpr.id.original+" doesn't match "+s.path.original,this)}this.type="block";this.mustache=e;this.program=t;this.inverse=i;this.strip={left:e.strip.left,right:s.strip.right};(t||i).strip.left=e.strip.right;(i||t).strip.right=s.strip.left;if(i&&!t){this.isInverse=true}},ContentNode:function(e,t){r.call(this,t);this.type="content";this.string=e},HashNode:function(e,t){r.call(this,t);this.type="hash";this.pairs=e},IdNode:function(e,t){r.call(this,t);this.type="ID";var i="",s=[],o=0;for(var u=0,a=e.length;u<a;u++){var f=e[u].part;i+=(e[u].separator||"")+f;if(f===".."||f==="."||f==="this"){if(s.length>0){throw new n("Invalid path: "+i,this)}else if(f===".."){o++}else{this.isScoped=true}}else{s.push(f)}}this.original=i;this.parts=s;this.string=s.join(".");this.depth=o;this.isSimple=e.length===1&&!this.isScoped&&o===0;this.stringModeValue=this.string},PartialNameNode:function(e,t){r.call(this,t);this.type="PARTIAL_NAME";this.name=e.original},DataNode:function(e,t){r.call(this,t);this.type="DATA";this.id=e},StringNode:function(e,t){r.call(this,t);this.type="STRING";this.original=this.string=this.stringModeValue=e},IntegerNode:function(e,t){r.call(this,t);this.type="INTEGER";this.original=this.integer=e;this.stringModeValue=Number(e)},BooleanNode:function(e,t){r.call(this,t);this.type="BOOLEAN";this.bool=e;this.stringModeValue=e==="true"},CommentNode:function(e,t){r.call(this,t);this.type="comment";this.comment=e}};t=i;return t}(n);var u=function(){"use strict";var e;var t=function(){function t(e,t){return{left:e.charAt(2)==="~",right:t.charAt(0)==="~"||t.charAt(1)==="~"}}function r(){this.yy={}}var e={trace:function(){},yy:{},symbols_:{error:2,root:3,statements:4,EOF:5,program:6,simpleInverse:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,sexpr:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,partial_option0:27,sexpr_repetition0:28,sexpr_option0:29,dataName:30,param:31,STRING:32,INTEGER:33,BOOLEAN:34,OPEN_SEXPR:35,CLOSE_SEXPR:36,hash:37,hash_repetition_plus0:38,hashSegment:39,ID:40,EQUALS:41,DATA:42,pathSegments:43,SEP:44,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",32:"STRING",33:"INTEGER",34:"BOOLEAN",35:"OPEN_SEXPR",36:"CLOSE_SEXPR",40:"ID",41:"EQUALS",42:"DATA",44:"SEP"},productions_:[0,[3,2],[3,1],[6,2],[6,3],[6,2],[6,1],[6,1],[6,0],[4,1],[4,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,4],[7,2],[17,3],[17,1],[31,1],[31,1],[31,1],[31,1],[31,1],[31,3],[37,1],[39,3],[26,1],[26,1],[26,1],[30,2],[21,1],[43,3],[43,1],[27,0],[27,1],[28,0],[28,2],[29,0],[29,1],[38,1],[38,2]],performAction:function(n,r,i,s,o,u,a){var f=u.length-1;switch(o){case 1:return new s.ProgramNode(u[f-1],this._$);break;case 2:return new s.ProgramNode([],this._$);break;case 3:this.$=new s.ProgramNode([],u[f-1],u[f],this._$);break;case 4:this.$=new s.ProgramNode(u[f-2],u[f-1],u[f],this._$);break;case 5:this.$=new s.ProgramNode(u[f-1],u[f],[],this._$);break;case 6:this.$=new s.ProgramNode(u[f],this._$);break;case 7:this.$=new s.ProgramNode([],this._$);break;case 8:this.$=new s.ProgramNode([],this._$);break;case 9:this.$=[u[f]];break;case 10:u[f-1].push(u[f]);this.$=u[f-1];break;case 11:this.$=new s.BlockNode(u[f-2],u[f-1].inverse,u[f-1],u[f],this._$);break;case 12:this.$=new s.BlockNode(u[f-2],u[f-1],u[f-1].inverse,u[f],this._$);break;case 13:this.$=u[f];break;case 14:this.$=u[f];break;case 15:this.$=new s.ContentNode(u[f],this._$);break;case 16:this.$=new s.CommentNode(u[f],this._$);break;case 17:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 18:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 19:this.$={path:u[f-1],strip:t(u[f-2],u[f])};break;case 20:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 21:this.$=new s.MustacheNode(u[f-1],null,u[f-2],t(u[f-2],u[f]),this._$);break;case 22:this.$=new s.PartialNode(u[f-2],u[f-1],t(u[f-3],u[f]),this._$);break;case 23:this.$=t(u[f-1],u[f]);break;case 24:this.$=new s.SexprNode([u[f-2]].concat(u[f-1]),u[f],this._$);break;case 25:this.$=new s.SexprNode([u[f]],null,this._$);break;case 26:this.$=u[f];break;case 27:this.$=new s.StringNode(u[f],this._$);break;case 28:this.$=new s.IntegerNode(u[f],this._$);break;case 29:this.$=new s.BooleanNode(u[f],this._$);break;case 30:this.$=u[f];break;case 31:u[f-1].isHelper=true;this.$=u[f-1];break;case 32:this.$=new s.HashNode(u[f],this._$);break;case 33:this.$=[u[f-2],u[f]];break;case 34:this.$=new s.PartialNameNode(u[f],this._$);break;case 35:this.$=new s.PartialNameNode(new s.StringNode(u[f],this._$),this._$);break;case 36:this.$=new s.PartialNameNode(new s.IntegerNode(u[f],this._$));break;case 37:this.$=new s.DataNode(u[f],this._$);break;case 38:this.$=new s.IdNode(u[f],this._$);break;case 39:u[f-2].push({part:u[f],separator:u[f-1]});this.$=u[f-2];break;case 40:this.$=[{part:u[f]}];break;case 43:this.$=[];break;case 44:u[f-1].push(u[f]);break;case 47:this.$=[u[f]];break;case 48:u[f-1].push(u[f]);break}},table:[{3:1,4:2,5:[1,3],8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[3]},{5:[1,16],8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],22:[1,13],23:[1,14],25:[1,15]},{1:[2,2]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{4:20,6:18,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{4:20,6:22,7:19,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,8],22:[1,13],23:[1,14],25:[1,15]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{5:[2,16],14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{17:23,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:29,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:30,21:24,30:25,40:[1,28],42:[1,27],43:26},{17:31,21:24,30:25,40:[1,28],42:[1,27],43:26},{21:33,26:32,32:[1,34],33:[1,35],40:[1,28],43:26},{1:[2,1]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{10:36,20:[1,37]},{4:38,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,7],22:[1,13],23:[1,14],25:[1,15]},{7:39,8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,21],20:[2,6],22:[1,13],23:[1,14],25:[1,15]},{17:23,18:[1,40],21:24,30:25,40:[1,28],42:[1,27],43:26},{10:41,20:[1,37]},{18:[1,42]},{18:[2,43],24:[2,43],28:43,32:[2,43],33:[2,43],34:[2,43],35:[2,43],36:[2,43],40:[2,43],42:[2,43]},{18:[2,25],24:[2,25],36:[2,25]},{18:[2,38],24:[2,38],32:[2,38],33:[2,38],34:[2,38],35:[2,38],36:[2,38],40:[2,38],42:[2,38],44:[1,44]},{21:45,40:[1,28],43:26},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],42:[2,40],44:[2,40]},{18:[1,46]},{18:[1,47]},{24:[1,48]},{18:[2,41],21:50,27:49,40:[1,28],43:26},{18:[2,34],40:[2,34]},{18:[2,35],40:[2,35]},{18:[2,36],40:[2,36]},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{21:51,40:[1,28],43:26},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,3],22:[1,13],23:[1,14],25:[1,15]},{4:52,8:4,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,5],22:[1,13],23:[1,14],25:[1,15]},{14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]},{18:[2,45],21:56,24:[2,45],29:53,30:60,31:54,32:[1,57],33:[1,58],34:[1,59],35:[1,61],36:[2,45],37:55,38:62,39:63,40:[1,64],42:[1,27],43:26},{40:[1,65]},{18:[2,37],24:[2,37],32:[2,37],33:[2,37],34:[2,37],35:[2,37],36:[2,37],40:[2,37],42:[2,37]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,66]},{18:[2,42]},{18:[1,67]},{8:17,9:5,11:6,12:7,13:8,14:[1,9],15:[1,10],16:[1,12],19:[1,11],20:[2,4],22:[1,13],23:[1,14],25:[1,15]},{18:[2,24],24:[2,24],36:[2,24]},{18:[2,44],24:[2,44],32:[2,44],33:[2,44],34:[2,44],35:[2,44],36:[2,44],40:[2,44],42:[2,44]},{18:[2,46],24:[2,46],36:[2,46]},{18:[2,26],24:[2,26],32:[2,26],33:[2,26],34:[2,26],35:[2,26],36:[2,26],40:[2,26],42:[2,26]},{18:[2,27],24:[2,27],32:[2,27],33:[2,27],34:[2,27],35:[2,27],36:[2,27],40:[2,27],42:[2,27]},{18:[2,28],24:[2,28],32:[2,28],33:[2,28],34:[2,28],35:[2,28],36:[2,28],40:[2,28],42:[2,28]},{18:[2,29],24:[2,29],32:[2,29],33:[2,29],34:[2,29],35:[2,29],36:[2,29],40:[2,29],42:[2,29]},{18:[2,30],24:[2,30],32:[2,30],33:[2,30],34:[2,30],35:[2,30],36:[2,30],40:[2,30],42:[2,30]},{17:68,21:24,30:25,40:[1,28],42:[1,27],43:26},{18:[2,32],24:[2,32],36:[2,32],39:69,40:[1,70]},{18:[2,47],24:[2,47],36:[2,47],40:[2,47]},{18:[2,40],24:[2,40],32:[2,40],33:[2,40],34:[2,40],35:[2,40],36:[2,40],40:[2,40],41:[1,71],42:[2,40],44:[2,40]},{18:[2,39],24:[2,39],32:[2,39],33:[2,39],34:[2,39],35:[2,39],36:[2,39],40:[2,39],42:[2,39],44:[2,39]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{36:[1,72]},{18:[2,48],24:[2,48],36:[2,48],40:[2,48]},{41:[1,71]},{21:56,30:60,31:73,32:[1,57],33:[1,58],34:[1,59],35:[1,61],40:[1,28],42:[1,27],43:26},{18:[2,31],24:[2,31],32:[2,31],33:[2,31],34:[2,31],35:[2,31],36:[2,31],40:[2,31],42:[2,31]},{18:[2,33],24:[2,33],36:[2,33],40:[2,33]}],defaultActions:{3:[2,2],16:[2,1],50:[2,42]},parseError:function(t,n){throw new Error(t)},parse:function(t){function v(e){r.length=r.length-2*e;i.length=i.length-e;s.length=s.length-e}function m(){var e;e=n.lexer.lex()||1;if(typeof e!=="number"){e=n.symbols_[e]||e}return e}var n=this,r=[0],i=[null],s=[],o=this.table,u="",a=0,f=0,l=0,c=2,h=1;this.lexer.setInput(t);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;this.yy.parser=this;if(typeof this.lexer.yylloc=="undefined")this.lexer.yylloc={};var p=this.lexer.yylloc;s.push(p);var d=this.lexer.options&&this.lexer.options.ranges;if(typeof this.yy.parseError==="function")this.parseError=this.yy.parseError;var g,y,b,w,E,S,x={},T,N,C,k;while(true){b=r[r.length-1];if(this.defaultActions[b]){w=this.defaultActions[b]}else{if(g===null||typeof g=="undefined"){g=m()}w=o[b]&&o[b][g]}if(typeof w==="undefined"||!w.length||!w[0]){var L="";if(!l){k=[];for(T in o[b])if(this.terminals_[T]&&T>2){k.push("'"+this.terminals_[T]+"'")}if(this.lexer.showPosition){L="Parse error on line "+(a+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+k.join(", ")+", got '"+(this.terminals_[g]||g)+"'"}else{L="Parse error on line "+(a+1)+": Unexpected "+(g==1?"end of input":"'"+(this.terminals_[g]||g)+"'")}this.parseError(L,{text:this.lexer.match,token:this.terminals_[g]||g,line:this.lexer.yylineno,loc:p,expected:k})}}if(w[0]instanceof Array&&w.length>1){throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+g)}switch(w[0]){case 1:r.push(g);i.push(this.lexer.yytext);s.push(this.lexer.yylloc);r.push(w[1]);g=null;if(!y){f=this.lexer.yyleng;u=this.lexer.yytext;a=this.lexer.yylineno;p=this.lexer.yylloc;if(l>0)l--}else{g=y;y=null}break;case 2:N=this.productions_[w[1]][1];x.$=i[i.length-N];x._$={first_line:s[s.length-(N||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(N||1)].first_column,last_column:s[s.length-1].last_column};if(d){x._$.range=[s[s.length-(N||1)].range[0],s[s.length-1].range[1]]}S=this.performAction.call(x,u,f,a,this.yy,w[1],i,s);if(typeof S!=="undefined"){return S}if(N){r=r.slice(0,-1*N*2);i=i.slice(0,-1*N);s=s.slice(0,-1*N)}r.push(this.productions_[w[1]][0]);i.push(x.$);s.push(x._$);C=o[r[r.length-2]][r[r.length-1]];r.push(C);break;case 3:return true}}return true}};var n=function(){var e={EOF:1,parseError:function(t,n){if(this.yy.parser){this.yy.parser.parseError(t,n)}else{throw new Error(t)}},setInput:function(e){this._input=e;this._more=this._less=this.done=false;this.yylineno=this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};if(this.options.ranges)this.yylloc.range=[0,0];this.offset=0;return this},input:function(){var e=this._input[0];this.yytext+=e;this.yyleng++;this.offset++;this.match+=e;this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);if(t){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges)this.yylloc.range[1]++;this._input=this._input.slice(1);return e},unput:function(e){var t=e.length;var n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-t-1);this.offset-=t;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);if(n.length-1)this.yylineno-=n.length-1;var i=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t};if(this.options.ranges){this.yylloc.range=[i[0],i[0]+this.yyleng-t]}return this},more:function(){this._more=true;return this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;if(e.length<20){e+=this._input.substr(0,20-e.length)}return(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput();var t=(new Array(e.length+1)).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done){return this.EOF}if(!this._input)this.done=true;var e,t,n,r,i,s;if(!this._more){this.yytext="";this.match=""}var o=this._currentRules();for(var u=0;u<o.length;u++){n=this._input.match(this.rules[o[u]]);if(n&&(!t||n[0].length>t[0].length)){t=n;r=u;if(!this.options.flex)break}}if(t){s=t[0].match(/(?:\r\n?|\n).*/g);if(s)this.yylineno+=s.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length};this.yytext+=t[0];this.match+=t[0];this.matches=t;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._input=this._input.slice(t[0].length);this.matched+=t[0];e=this.performAction.call(this,this.yy,this,o[r],this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input)this.done=false;if(e)return e;else return}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function(){var t=this.next();if(typeof t!=="undefined"){return t}else{return this.lex()}},begin:function(t){this.conditionStack.push(t)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(t){this.begin(t)}};e.options={};e.performAction=function(t,n,r,i){function s(e,t){return n.yytext=n.yytext.substr(e,n.yyleng-t)}var o=i;switch(r){case 0:if(n.yytext.slice(-2)==="\\\\"){s(0,1);this.begin("mu")}else if(n.yytext.slice(-1)==="\\"){s(0,1);this.begin("emu")}else{this.begin("mu")}if(n.yytext)return 14;break;case 1:return 14;break;case 2:this.popState();return 14;break;case 3:s(0,4);this.popState();return 15;break;case 4:return 35;break;case 5:return 36;break;case 6:return 25;break;case 7:return 16;break;case 8:return 20;break;case 9:return 19;break;case 10:return 19;break;case 11:return 23;break;case 12:return 22;break;case 13:this.popState();this.begin("com");break;case 14:s(3,5);this.popState();return 15;break;case 15:return 22;break;case 16:return 41;break;case 17:return 40;break;case 18:return 40;break;case 19:return 44;break;case 20:break;case 21:this.popState();return 24;break;case 22:this.popState();return 18;break;case 23:n.yytext=s(1,2).replace(/\\"/g,'"');return 32;break;case 24:n.yytext=s(1,2).replace(/\\'/g,"'");return 32;break;case 25:return 42;break;case 26:return 34;break;case 27:return 34;break;case 28:return 33;break;case 29:return 40;break;case 30:n.yytext=s(1,2);return 40;break;case 31:return"INVALID";break;case 32:return 5;break}};e.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];e.conditions={mu:{rules:[4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32],inclusive:false},emu:{rules:[2],inclusive:false},com:{rules:[3],inclusive:false},INITIAL:{rules:[0,1,32],inclusive:true}};return e}();e.lexer=n;r.prototype=e;e.Parser=r;return new r}();e=t;return e}();var a=function(e,t){"use strict";function s(e){if(e.constructor===i.ProgramNode){return e}r.yy=i;return r.parse(e)}var n={};var r=e;var i=t;n.parser=r;n.parse=s;return n}(u,o);var f=function(e){"use strict";function r(){}function i(e,t,r){if(e==null||typeof e!=="string"&&e.constructor!==r.AST.ProgramNode){throw new n("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+e)}t=t||{};if(!("data"in t)){t.data=true}var i=r.parse(e);var s=(new r.Compiler).compile(i,t);return(new r.JavaScriptCompiler).compile(s,t)}function s(e,t,r){function s(){var n=r.parse(e);var i=(new r.Compiler).compile(n,t);var s=(new r.JavaScriptCompiler).compile(i,t,undefined,true);return r.template(s)}if(e==null||typeof e!=="string"&&e.constructor!==r.AST.ProgramNode){throw new n("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+e)}t=t||{};if(!("data"in t)){t.data=true}var i;return function(e,t){if(!i){i=s()}return i.call(this,e,t)}}var t={};var n=e;t.Compiler=r;r.prototype={compiler:r,disassemble:function(){var e=this.opcodes,t,n=[],r,i;for(var s=0,o=e.length;s<o;s++){t=e[s];if(t.opcode==="DECLARE"){n.push("DECLARE "+t.name+"="+t.value)}else{r=[];for(var u=0;u<t.args.length;u++){i=t.args[u];if(typeof i==="string"){i='"'+i.replace("\n","\\n")+'"'}r.push(i)}n.push(t.opcode+" "+r.join(" "))}}return n.join("\n")},equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t){return false}for(var n=0;n<t;n++){var r=this.opcodes[n],i=e.opcodes[n];if(r.opcode!==i.opcode||r.args.length!==i.args.length){return false}for(var s=0;s<r.args.length;s++){if(r.args[s]!==i.args[s]){return false}}}t=this.children.length;if(e.children.length!==t){return false}for(n=0;n<t;n++){if(!this.children[n].equals(e.children[n])){return false}}return true},guid:0,compile:function(e,t){this.opcodes=[];this.children=[];this.depths={list:[]};this.options=t;var n=this.options.knownHelpers;this.options.knownHelpers={helperMissing:true,blockHelperMissing:true,each:true,"if":true,unless:true,"with":true,log:true};if(n){for(var r in n){this.options.knownHelpers[r]=n[r]}}return this.accept(e)},accept:function(e){var t=e.strip||{},n;if(t.left){this.opcode("strip")}n=this[e.type](e);if(t.right){this.opcode("strip")}return n},program:function(e){var t=e.statements;for(var n=0,r=t.length;n<r;n++){this.accept(t[n])}this.isSimple=r===1;this.depths.list=this.depths.list.sort(function(e,t){return e-t});return this},compileProgram:function(e){var t=(new this.compiler).compile(e,this.options);var n=this.guid++,r;this.usePartial=this.usePartial||t.usePartial;this.children[n]=t;for(var i=0,s=t.depths.list.length;i<s;i++){r=t.depths.list[i];if(r<2){continue}else{this.addDepth(r-1)}}return n},block:function(e){var t=e.mustache,n=e.program,r=e.inverse;if(n){n=this.compileProgram(n)}if(r){r=this.compileProgram(r)}var i=t.sexpr;var s=this.classifySexpr(i);if(s==="helper"){this.helperSexpr(i,n,r)}else if(s==="simple"){this.simpleSexpr(i);this.opcode("pushProgram",n);this.opcode("pushProgram",r);this.opcode("emptyHash");this.opcode("blockValue")}else{this.ambiguousSexpr(i,n,r);this.opcode("pushProgram",n);this.opcode("pushProgram",r);this.opcode("emptyHash");this.opcode("ambiguousBlockValue")}this.opcode("append")},hash:function(e){var t=e.pairs,n,r;this.opcode("pushHash");for(var i=0,s=t.length;i<s;i++){n=t[i];r=n[1];if(this.options.stringParams){if(r.depth){this.addDepth(r.depth)}this.opcode("getContext",r.depth||0);this.opcode("pushStringParam",r.stringModeValue,r.type);if(r.type==="sexpr"){this.sexpr(r)}}else{this.accept(r)}this.opcode("assignToHash",n[0])}this.opcode("popHash")},partial:function(e){var t=e.partialName;this.usePartial=true;if(e.context){this.ID(e.context)}else{this.opcode("push","depth0")}this.opcode("invokePartial",t.name);this.opcode("append")},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){this.sexpr(e.sexpr);if(e.escaped&&!this.options.noEscape){this.opcode("appendEscaped")}else{this.opcode("append")}},ambiguousSexpr:function(e,t,n){var r=e.id,i=r.parts[0],s=t!=null||n!=null;this.opcode("getContext",r.depth);this.opcode("pushProgram",t);this.opcode("pushProgram",n);this.opcode("invokeAmbiguous",i,s)},simpleSexpr:function(e){var t=e.id;if(t.type==="DATA"){this.DATA(t)}else if(t.parts.length){this.ID(t)}else{this.addDepth(t.depth);this.opcode("getContext",t.depth);this.opcode("pushContext")}this.opcode("resolvePossibleLambda")},helperSexpr:function(e,t,r){var i=this.setupFullMustacheParams(e,t,r),s=e.id.parts[0];if(this.options.knownHelpers[s]){this.opcode("invokeKnownHelper",i.length,s)}else if(this.options.knownHelpersOnly){throw new n("You specified knownHelpersOnly, but used the unknown helper "+s,e)}else{this.opcode("invokeHelper",i.length,s,e.isRoot)}},sexpr:function(e){var t=this.classifySexpr(e);if(t==="simple"){this.simpleSexpr(e)}else if(t==="helper"){this.helperSexpr(e)}else{this.ambiguousSexpr(e)}},ID:function(e){this.addDepth(e.depth);this.opcode("getContext",e.depth);var t=e.parts[0];if(!t){this.opcode("pushContext")}else{this.opcode("lookupOnContext",e.parts[0])}for(var n=1,r=e.parts.length;n<r;n++){this.opcode("lookup",e.parts[n])}},DATA:function(e){this.options.data=true;if(e.id.isScoped||e.id.depth){throw new n("Scoped data references are not supported: "+e.original,e)}this.opcode("lookupData");var t=e.id.parts;for(var r=0,i=t.length;r<i;r++){this.opcode("lookup",t[r])}},STRING:function(e){this.opcode("pushString",e.string)},INTEGER:function(e){this.opcode("pushLiteral",e.integer)},BOOLEAN:function(e){this.opcode("pushLiteral",e.bool)},comment:function(){},opcode:function(e){this.opcodes.push({opcode:e,args:[].slice.call(arguments,1)})},declare:function(e,t){this.opcodes.push({opcode:"DECLARE",name:e,value:t})},addDepth:function(e){if(e===0){return}if(!this.depths[e]){this.depths[e]=true;this.depths.list.push(e)}},classifySexpr:function(e){var t=e.isHelper;var n=e.eligibleHelper;var r=this.options;if(n&&!t){var i=e.id.parts[0];if(r.knownHelpers[i]){t=true}else if(r.knownHelpersOnly){n=false}}if(t){return"helper"}else if(n){return"ambiguous"}else{return"simple"}},pushParams:function(e){var t=e.length,n;while(t--){n=e[t];if(this.options.stringParams){if(n.depth){this.addDepth(n.depth)}this.opcode("getContext",n.depth||0);this.opcode("pushStringParam",n.stringModeValue,n.type);if(n.type==="sexpr"){this.sexpr(n)}}else{this[n.type](n)}}},setupFullMustacheParams:function(e,t,n){var r=e.params;this.pushParams(r);this.opcode("pushProgram",t);this.opcode("pushProgram",n);if(e.hash){this.hash(e.hash)}else{this.opcode("emptyHash")}return r}};t.precompile=i;t.compile=s;return t}(n);var l=function(e,t){"use strict";function u(e){this.value=e}function a(){}var n;var r=e.COMPILER_REVISION;var i=e.REVISION_CHANGES;var s=e.log;var o=t;a.prototype={nameLookup:function(e,t){var n,r;if(e.indexOf("depth")===0){n=true}if(/^[0-9]+$/.test(t)){r=e+"["+t+"]"}else if(a.isValidJavaScriptVariableName(t)){r=e+"."+t}else{r=e+"['"+t+"']"}if(n){return"("+e+" && "+r+")"}else{return r}},compilerInfo:function(){var e=r,t=i[e];return"this.compilerInfo = ["+e+",'"+t+"'];\n"},appendToBuffer:function(e){if(this.environment.isSimple){return"return "+e+";"}else{return{appendToBuffer:true,content:e,toString:function(){return"buffer += "+e+";"}}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(e,t,n,r){this.environment=e;this.options=t||{};s("debug",this.environment.disassemble()+"\n\n");this.name=this.environment.name;this.isChild=!!n;this.context=n||{programs:[],environments:[],aliases:{}};this.preamble();this.stackSlot=0;this.stackVars=[];this.registers={list:[]};this.hashes=[];this.compileStack=[];this.inlineStack=[];this.compileChildren(e,t);var i=e.opcodes,u;this.i=0;for(var a=i.length;this.i<a;this.i++){u=i[this.i];if(u.opcode==="DECLARE"){this[u.name]=u.value}else{this[u.opcode].apply(this,u.args)}if(u.opcode!==this.stripNext){this.stripNext=false}}this.pushSource("");if(this.stackSlot||this.inlineStack.length||this.compileStack.length){throw new o("Compile completed with content left on stack")}return this.createFunctionContext(r)},preamble:function(){var e=[];if(!this.isChild){var t=this.namespace;var n="helpers = this.merge(helpers, "+t+".helpers);";if(this.environment.usePartial){n=n+" partials = this.merge(partials, "+t+".partials);"}if(this.options.data){n=n+" data = data || {};"}e.push(n)}else{e.push("")}if(!this.environment.isSimple){e.push(", buffer = "+this.initializeBuffer())}else{e.push("")}this.lastContext=0;this.source=e},createFunctionContext:function(e){var t=this.stackVars.concat(this.registers.list);if(t.length>0){this.source[1]=this.source[1]+", "+t.join(", ")}if(!this.isChild){for(var n in this.context.aliases){if(this.context.aliases.hasOwnProperty(n)){this.source[1]=this.source[1]+", "+n+"="+this.context.aliases[n]}}}if(this.source[1]){this.source[1]="var "+this.source[1].substring(2)+";"}if(!this.isChild){this.source[1]+="\n"+this.context.programs.join("\n")+"\n"}if(!this.environment.isSimple){this.pushSource("return buffer;")}var r=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"];for(var i=0,o=this.environment.depths.list.length;i<o;i++){r.push("depth"+this.environment.depths.list[i])}var u=this.mergeSource();if(!this.isChild){u=this.compilerInfo()+u}if(e){r.push(u);return Function.apply(this,r)}else{var a="function "+(this.name||"")+"("+r.join(",")+") {\n "+u+"}";s("debug",a+"\n\n");return a}},mergeSource:function(){var e="",t;for(var n=0,r=this.source.length;n<r;n++){var i=this.source[n];if(i.appendToBuffer){if(t){t=t+"\n + "+i.content}else{t=i.content}}else{if(t){e+="buffer += "+t+";\n ";t=undefined}e+=i+"\n "}}return e},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);this.replaceStack(function(t){e.splice(1,0,t);return"blockHelperMissing.call("+e.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);var t=this.topStack();e.splice(1,0,t);this.pushSource("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+e.join(", ")+"); }")},appendContent:function(e){if(this.pendingContent){e=this.pendingContent+e}if(this.stripNext){e=e.replace(/^\s+/,"")}this.pendingContent=e},strip:function(){if(this.pendingContent){this.pendingContent=this.pendingContent.replace(/\s+$/,"")}this.stripNext="strip"},append:function(){this.flushInline();var e=this.popStack();this.pushSource("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }");if(this.environment.isSimple){this.pushSource("else { "+this.appendToBuffer("''")+" }")}},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression";this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(e){if(this.lastContext!==e){this.lastContext=e}},lookupOnContext:function(e){this.push(this.nameLookup("depth"+this.lastContext,e,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"';this.replaceStack(function(e){return"typeof "+e+" === functionType ? "+e+".apply(depth0) : "+e})},lookup:function(e){this.replaceStack(function(t){return t+" == null || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")})},lookupData:function(){this.pushStackLiteral("data")},pushStringParam:function(e,t){this.pushStackLiteral("depth"+this.lastContext);this.pushString(t);if(t!=="sexpr"){if(typeof e==="string"){this.pushString(e)}else{this.pushStackLiteral(e)}}},emptyHash:function(){this.pushStackLiteral("{}");if(this.options.stringParams){this.push("{}");this.push("{}")}},pushHash:function(){if(this.hash){this.hashes.push(this.hash)}this.hash={values:[],types:[],contexts:[]}},popHash:function(){var e=this.hash;this.hash=this.hashes.pop();if(this.options.stringParams){this.push("{"+e.contexts.join(",")+"}");this.push("{"+e.types.join(",")+"}")}this.push("{\n "+e.values.join(",\n ")+"\n }")},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},push:function(e){this.inlineStack.push(e);return e},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){if(e!=null){this.pushStackLiteral(this.programExpression(e))}else{this.pushStackLiteral(null)}},invokeHelper:function(e,t,n){this.context.aliases.helperMissing="helpers.helperMissing";this.useRegister("helper");var r=this.lastHelper=this.setupHelper(e,t,true);var i=this.nameLookup("depth"+this.lastContext,t,"context");var s="helper = "+r.name+" || "+i;if(r.paramsInit){s+=","+r.paramsInit}this.push("("+s+",helper "+"? helper.call("+r.callParams+") "+": helperMissing.call("+r.helperMissingParams+"))");if(!n){this.flushInline()}},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.push(n.name+".call("+n.callParams+")")},invokeAmbiguous:function(e,t){this.context.aliases.functionType='"function"';this.useRegister("helper");this.emptyHash();var n=this.setupHelper(0,e,t);var r=this.lastHelper=this.nameLookup("helpers",e,"helper");var i=this.nameLookup("depth"+this.lastContext,e,"context");var s=this.nextStack();if(n.paramsInit){this.pushSource(n.paramsInit)}this.pushSource("if (helper = "+r+") { "+s+" = helper.call("+n.callParams+"); }");this.pushSource("else { helper = "+i+"; "+s+" = typeof helper === functionType ? helper.call("+n.callParams+") : helper; }")},invokePartial:function(e){var t=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"];if(this.options.data){t.push("data")}this.context.aliases.self="this";this.push("self.invokePartial("+t.join(", ")+")")},assignToHash:function(e){var t=this.popStack(),n,r;if(this.options.stringParams){r=this.popStack();n=this.popStack()}var i=this.hash;if(n){i.contexts.push("'"+e+"': "+n)}if(r){i.types.push("'"+e+"': "+r)}i.values.push("'"+e+"': ("+t+")")},compiler:a,compileChildren:function(e,t){var n=e.children,r,i;for(var s=0,o=n.length;s<o;s++){r=n[s];i=new this.compiler;var u=this.matchExistingProgram(r);if(u==null){this.context.programs.push("");u=this.context.programs.length;r.index=u;r.name="program"+u;this.context.programs[u]=i.compile(r,t,this.context);this.context.environments[u]=r}else{r.index=u;r.name="program"+u}}},matchExistingProgram:function(e){for(var t=0,n=this.context.environments.length;t<n;t++){var r=this.context.environments[t];if(r&&r.equals(e)){return t}}},programExpression:function(e){this.context.aliases.self="this";if(e==null){return"self.noop"}var t=this.environment.children[e],n=t.depths.list,r;var i=[t.index,t.name,"data"];for(var s=0,o=n.length;s<o;s++){r=n[s];if(r===1){i.push("depth0")}else{i.push("depth"+(r-1))}}return(n.length===0?"self.program(":"self.programWithDepth(")+i.join(", ")+")"},register:function(e,t){this.useRegister(e);this.pushSource(e+" = "+t+";")},useRegister:function(e){if(!this.registers[e]){this.registers[e]=true;this.registers.list.push(e)}},pushStackLiteral:function(e){return this.push(new u(e))},pushSource:function(e){if(this.pendingContent){this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));this.pendingContent=undefined}if(e){this.source.push(e)}},pushStack:function(e){this.flushInline();var t=this.incrStack();if(e){this.pushSource(t+" = "+e+";")}this.compileStack.push(t);return t},replaceStack:function(e){var t="",n=this.isInline(),r,i,s;if(n){var o=this.popStack(true);if(o instanceof u){r=o.value;s=true}else{i=!this.stackSlot;var a=!i?this.topStackName():this.incrStack();t="("+this.push(a)+" = "+o+"),";r=this.topStack()}}else{r=this.topStack()}var f=e.call(this,r);if(n){if(!s){this.popStack()}if(i){this.stackSlot--}this.push("("+t+f+")")}else{if(!/^stack/.test(r)){r=this.nextStack()}this.pushSource(r+" = ("+t+f+");")}return r},nextStack:function(){return this.pushStack()},incrStack:function(){this.stackSlot++;if(this.stackSlot>this.stackVars.length){this.stackVars.push("stack"+this.stackSlot)}return this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;if(e.length){this.inlineStack=[];for(var t=0,n=e.length;t<n;t++){var r=e[t];if(r instanceof u){this.compileStack.push(r)}else{this.pushStack(r)}}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),n=(t?this.inlineStack:this.compileStack).pop();if(!e&&n instanceof u){return n.value}else{if(!t){if(!this.stackSlot){throw new o("Invalid stack pop")}this.stackSlot--}return n}},topStack:function(e){var t=this.isInline()?this.inlineStack:this.compileStack,n=t[t.length-1];if(!e&&n instanceof u){return n.value}else{return n}},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(e,t,n){var r=[],i=this.setupParams(e,r,n);var s=this.nameLookup("helpers",t,"helper");return{params:r,paramsInit:i,name:s,callParams:["depth0"].concat(r).join(", "),helperMissingParams:n&&["depth0",this.quotedString(t)].concat(r).join(", ")}},setupOptions:function(e,t){var n=[],r=[],i=[],s,o,u;n.push("hash:"+this.popStack());if(this.options.stringParams){n.push("hashTypes:"+this.popStack());n.push("hashContexts:"+this.popStack())}o=this.popStack();u=this.popStack();if(u||o){if(!u){this.context.aliases.self="this";u="self.noop"}if(!o){this.context.aliases.self="this";o="self.noop"}n.push("inverse:"+o);n.push("fn:"+u)}for(var a=0;a<e;a++){s=this.popStack();t.push(s);if(this.options.stringParams){i.push(this.popStack());r.push(this.popStack())}}if(this.options.stringParams){n.push("contexts:["+r.join(",")+"]");n.push("types:["+i.join(",")+"]")}if(this.options.data){n.push("data:data")}return n},setupParams:function(e,t,n){var r="{"+this.setupOptions(e,t).join(",")+"}";if(n){this.useRegister("options");t.push("options");return"options="+r}else{t.push(r);return""}}};var f=("break else new var"+" case finally return void"+" catch for switch while"+" continue function this with"+" default if throw"+" delete in try"+" do instanceof typeof"+" abstract enum int short"+" boolean export interface static"+" byte extends long super"+" char final native synchronized"+" class float package throws"+" const goto private transient"+" debugger implements protected volatile"+" double import public let yield").split(" ");var l=a.RESERVED_WORDS={};for(var c=0,h=f.length;c<h;c++){l[f[c]]=true}a.isValidJavaScriptVariableName=function(e){if(!a.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)){return true}return false};n=a;return n}(r,n);var c=function(e,t,n,r,i){"use strict";var s;var o=e;var u=t;var a=n.parser;var f=n.parse;var l=r.Compiler;var c=r.compile;var h=r.precompile;var p=i;var d=o.create;var v=function(){var e=d();e.compile=function(t,n){return c(t,n,e)};e.precompile=function(t,n){return h(t,n,e)};e.AST=u;e.Compiler=l;e.JavaScriptCompiler=p;e.Parser=a;e.parse=f;return e};o=v();o.create=v;s=o;return s}(s,o,a,f,l);return c}() | ||
!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.Handlebars=a.Handlebars||b()}(this,function(){var a=function(){"use strict";function a(a){this.string=a}var b;return a.prototype.toString=function(){return""+this.string},b=a}(),b=function(a){"use strict";function b(a){return i[a]}function c(a){for(var b=1;b<arguments.length;b++)for(var c in arguments[b])Object.prototype.hasOwnProperty.call(arguments[b],c)&&(a[c]=arguments[b][c]);return a}function d(a){return a instanceof h?a.toString():null==a?"":a?(a=""+a,k.test(a)?a.replace(j,b):a):a+""}function e(a){return a||0===a?n(a)&&0===a.length?!0:!1:!0}function f(a,b){return(a?a+".":"")+b}var g={},h=a,i={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},j=/[&<>"'`]/g,k=/[&<>"'`]/;g.extend=c;var l=Object.prototype.toString;g.toString=l;var m=function(a){return"function"==typeof a};m(/x/)&&(m=function(a){return"function"==typeof a&&"[object Function]"===l.call(a)});var m;g.isFunction=m;var n=Array.isArray||function(a){return a&&"object"==typeof a?"[object Array]"===l.call(a):!1};return g.isArray=n,g.escapeExpression=d,g.isEmpty=e,g.appendContextPath=f,g}(a),c=function(){"use strict";function a(a,b){var d;b&&b.firstLine&&(d=b.firstLine,a+=" - "+d+":"+b.firstColumn);for(var e=Error.prototype.constructor.call(this,a),f=0;f<c.length;f++)this[c[f]]=e[c[f]];d&&(this.lineNumber=d,this.column=b.firstColumn)}var b,c=["description","fileName","lineNumber","message","name","number","stack"];return a.prototype=new Error,b=a}(),d=function(a,b){"use strict";function c(a,b){this.helpers=a||{},this.partials=b||{},d(this)}function d(a){a.registerHelper("helperMissing",function(){if(1===arguments.length)return void 0;throw new g("Missing helper: '"+arguments[arguments.length-1].name+"'")}),a.registerHelper("blockHelperMissing",function(b,c){var d=c.inverse,e=c.fn;if(b===!0)return e(this);if(b===!1||null==b)return d(this);if(k(b))return b.length>0?(c.ids&&(c.ids=[c.name]),a.helpers.each(b,c)):d(this);if(c.data&&c.ids){var g=q(c.data);g.contextPath=f.appendContextPath(c.data.contextPath,c.name),c={data:g}}return e(b,c)}),a.registerHelper("each",function(a,b){if(!b)throw new g("Must pass iterator to #each");var c,d,e=b.fn,h=b.inverse,i=0,j="";if(b.data&&b.ids&&(d=f.appendContextPath(b.data.contextPath,b.ids[0])+"."),l(a)&&(a=a.call(this)),b.data&&(c=q(b.data)),a&&"object"==typeof a)if(k(a))for(var m=a.length;m>i;i++)c&&(c.index=i,c.first=0===i,c.last=i===a.length-1,d&&(c.contextPath=d+i)),j+=e(a[i],{data:c});else for(var n in a)a.hasOwnProperty(n)&&(c&&(c.key=n,c.index=i,c.first=0===i,d&&(c.contextPath=d+n)),j+=e(a[n],{data:c}),i++);return 0===i&&(j=h(this)),j}),a.registerHelper("if",function(a,b){return l(a)&&(a=a.call(this)),!b.hash.includeZero&&!a||f.isEmpty(a)?b.inverse(this):b.fn(this)}),a.registerHelper("unless",function(b,c){return a.helpers["if"].call(this,b,{fn:c.inverse,inverse:c.fn,hash:c.hash})}),a.registerHelper("with",function(a,b){l(a)&&(a=a.call(this));var c=b.fn;if(f.isEmpty(a))return b.inverse(this);if(b.data&&b.ids){var d=q(b.data);d.contextPath=f.appendContextPath(b.data.contextPath,b.ids[0]),b={data:d}}return c(a,b)}),a.registerHelper("log",function(b,c){var d=c.data&&null!=c.data.level?parseInt(c.data.level,10):1;a.log(d,b)}),a.registerHelper("lookup",function(a,b){return a&&a[b]})}var e={},f=a,g=b,h="2.0.0";e.VERSION=h;var i=6;e.COMPILER_REVISION=i;var j={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};e.REVISION_CHANGES=j;var k=f.isArray,l=f.isFunction,m=f.toString,n="[object Object]";e.HandlebarsEnvironment=c,c.prototype={constructor:c,logger:o,log:p,registerHelper:function(a,b){if(m.call(a)===n){if(b)throw new g("Arg not supported with multiple helpers");f.extend(this.helpers,a)}else this.helpers[a]=b},unregisterHelper:function(a){delete this.helpers[a]},registerPartial:function(a,b){m.call(a)===n?f.extend(this.partials,a):this.partials[a]=b},unregisterPartial:function(a){delete this.partials[a]}};var o={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(a,b){if(o.level<=a){var c=o.methodMap[a];"undefined"!=typeof console&&console[c]&&console[c].call(console,b)}}};e.logger=o;var p=o.log;e.log=p;var q=function(a){var b=f.extend({},a);return b._parent=a,b};return e.createFrame=q,e}(b,c),e=function(a,b,c){"use strict";function d(a){var b=a&&a[0]||1,c=m;if(b!==c){if(c>b){var d=n[c],e=n[b];throw new l("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+d+") or downgrade your runtime to an older version ("+e+").")}throw new l("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+a[1]+").")}}function e(a,b){if(!b)throw new l("No environment passed to template");if(!a||!a.main)throw new l("Unknown template object: "+typeof a);b.VM.checkRevision(a.compiler);var c=function(c,d,e,f,g,h,i,j,m){g&&(f=k.extend({},f,g));var n=b.VM.invokePartial.call(this,c,e,f,h,i,j,m);if(null==n&&b.compile){var o={helpers:h,partials:i,data:j,depths:m};i[e]=b.compile(c,{data:void 0!==j,compat:a.compat},b),n=i[e](f,o)}if(null!=n){if(d){for(var p=n.split("\n"),q=0,r=p.length;r>q&&(p[q]||q+1!==r);q++)p[q]=d+p[q];n=p.join("\n")}return n}throw new l("The partial "+e+" could not be compiled when running in runtime-only mode")},d={lookup:function(a,b){for(var c=a.length,d=0;c>d;d++)if(a[d]&&null!=a[d][b])return a[d][b]},lambda:function(a,b){return"function"==typeof a?a.call(b):a},escapeExpression:k.escapeExpression,invokePartial:c,fn:function(b){return a[b]},programs:[],program:function(a,b,c){var d=this.programs[a],e=this.fn(a);return b||c?d=f(this,a,e,b,c):d||(d=this.programs[a]=f(this,a,e)),d},data:function(a,b){for(;a&&b--;)a=a._parent;return a},merge:function(a,b){var c=a||b;return a&&b&&a!==b&&(c=k.extend({},b,a)),c},noop:b.VM.noop,compilerInfo:a.compiler},e=function(b,c){c=c||{};var f=c.data;e._setup(c),!c.partial&&a.useData&&(f=i(b,f));var g;return a.useDepths&&(g=c.depths?[b].concat(c.depths):[b]),a.main.call(d,b,d.helpers,d.partials,f,g)};return e.isTop=!0,e._setup=function(c){c.partial?(d.helpers=c.helpers,d.partials=c.partials):(d.helpers=d.merge(c.helpers,b.helpers),a.usePartial&&(d.partials=d.merge(c.partials,b.partials)))},e._child=function(b,c,e){if(a.useDepths&&!e)throw new l("must pass parent depths");return f(d,b,a[b],c,e)},e}function f(a,b,c,d,e){var f=function(b,f){return f=f||{},c.call(a,b,a.helpers,a.partials,f.data||d,e&&[b].concat(e))};return f.program=b,f.depth=e?e.length:0,f}function g(a,b,c,d,e,f,g){var h={partial:!0,helpers:d,partials:e,data:f,depths:g};if(void 0===a)throw new l("The partial "+b+" could not be found");return a instanceof Function?a(c,h):void 0}function h(){return""}function i(a,b){return b&&"root"in b||(b=b?o(b):{},b.root=a),b}var j={},k=a,l=b,m=c.COMPILER_REVISION,n=c.REVISION_CHANGES,o=c.createFrame;return j.checkRevision=d,j.template=e,j.program=f,j.invokePartial=g,j.noop=h,j}(b,c,d),f=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c,j=d,k=e,l=function(){var a=new g.HandlebarsEnvironment;return j.extend(a,g),a.SafeString=h,a.Exception=i,a.Utils=j,a.escapeExpression=j.escapeExpression,a.VM=k,a.template=function(b){return k.template(b,a)},a},m=l();return m.create=l,m["default"]=m,f=m}(d,a,c,b,e),g=function(a){"use strict";function b(a){a=a||{},this.firstLine=a.first_line,this.firstColumn=a.first_column,this.lastColumn=a.last_column,this.lastLine=a.last_line}var c,d=a,e={ProgramNode:function(a,c,d){b.call(this,d),this.type="program",this.statements=a,this.strip=c},MustacheNode:function(a,c,d,f,g){if(b.call(this,g),this.type="mustache",this.strip=f,null!=d&&d.charAt){var h=d.charAt(3)||d.charAt(2);this.escaped="{"!==h&&"&"!==h}else this.escaped=!!d;this.sexpr=a instanceof e.SexprNode?a:new e.SexprNode(a,c),this.id=this.sexpr.id,this.params=this.sexpr.params,this.hash=this.sexpr.hash,this.eligibleHelper=this.sexpr.eligibleHelper,this.isHelper=this.sexpr.isHelper},SexprNode:function(a,c,d){b.call(this,d),this.type="sexpr",this.hash=c;var e=this.id=a[0],f=this.params=a.slice(1);this.isHelper=!(!f.length&&!c),this.eligibleHelper=this.isHelper||e.isSimple},PartialNode:function(a,c,d,e,f){b.call(this,f),this.type="partial",this.partialName=a,this.context=c,this.hash=d,this.strip=e,this.strip.inlineStandalone=!0},BlockNode:function(a,c,d,e,f){b.call(this,f),this.type="block",this.mustache=a,this.program=c,this.inverse=d,this.strip=e,d&&!c&&(this.isInverse=!0)},RawBlockNode:function(a,c,f,g){if(b.call(this,g),a.sexpr.id.original!==f)throw new d(a.sexpr.id.original+" doesn't match "+f,this);c=new e.ContentNode(c,g),this.type="block",this.mustache=a,this.program=new e.ProgramNode([c],{},g)},ContentNode:function(a,c){b.call(this,c),this.type="content",this.original=this.string=a},HashNode:function(a,c){b.call(this,c),this.type="hash",this.pairs=a},IdNode:function(a,c){b.call(this,c),this.type="ID";for(var e="",f=[],g=0,h="",i=0,j=a.length;j>i;i++){var k=a[i].part;if(e+=(a[i].separator||"")+k,".."===k||"."===k||"this"===k){if(f.length>0)throw new d("Invalid path: "+e,this);".."===k?(g++,h+="../"):this.isScoped=!0}else f.push(k)}this.original=e,this.parts=f,this.string=f.join("."),this.depth=g,this.idName=h+this.string,this.isSimple=1===a.length&&!this.isScoped&&0===g,this.stringModeValue=this.string},PartialNameNode:function(a,c){b.call(this,c),this.type="PARTIAL_NAME",this.name=a.original},DataNode:function(a,c){b.call(this,c),this.type="DATA",this.id=a,this.stringModeValue=a.stringModeValue,this.idName="@"+a.stringModeValue},StringNode:function(a,c){b.call(this,c),this.type="STRING",this.original=this.string=this.stringModeValue=a},NumberNode:function(a,c){b.call(this,c),this.type="NUMBER",this.original=this.number=a,this.stringModeValue=Number(a)},BooleanNode:function(a,c){b.call(this,c),this.type="BOOLEAN",this.bool=a,this.stringModeValue="true"===a},CommentNode:function(a,c){b.call(this,c),this.type="comment",this.comment=a,this.strip={inlineStandalone:!0}}};return c=e}(c),h=function(){"use strict";var a,b=function(){function a(){this.yy={}}var b={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,CONTENT:12,COMMENT:13,openRawBlock:14,END_RAW_BLOCK:15,OPEN_RAW_BLOCK:16,sexpr:17,CLOSE_RAW_BLOCK:18,openBlock:19,block_option0:20,closeBlock:21,openInverse:22,block_option1:23,OPEN_BLOCK:24,CLOSE:25,OPEN_INVERSE:26,inverseAndProgram:27,INVERSE:28,OPEN_ENDBLOCK:29,path:30,OPEN:31,OPEN_UNESCAPED:32,CLOSE_UNESCAPED:33,OPEN_PARTIAL:34,partialName:35,param:36,partial_option0:37,partial_option1:38,sexpr_repetition0:39,sexpr_option0:40,dataName:41,STRING:42,NUMBER:43,BOOLEAN:44,OPEN_SEXPR:45,CLOSE_SEXPR:46,hash:47,hash_repetition_plus0:48,hashSegment:49,ID:50,EQUALS:51,DATA:52,pathSegments:53,SEP:54,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},productions_:[0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],performAction:function(a,b,c,d,e,f){var g=f.length-1;switch(e){case 1:return d.prepareProgram(f[g-1].statements,!0),f[g-1];case 2:this.$=new d.ProgramNode(d.prepareProgram(f[g]),{},this._$);break;case 3:this.$=f[g];break;case 4:this.$=f[g];break;case 5:this.$=f[g];break;case 6:this.$=f[g];break;case 7:this.$=new d.ContentNode(f[g],this._$);break;case 8:this.$=new d.CommentNode(f[g],this._$);break;case 9:this.$=new d.RawBlockNode(f[g-2],f[g-1],f[g],this._$);break;case 10:this.$=new d.MustacheNode(f[g-1],null,"","",this._$);break;case 11:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!1,this._$);break;case 12:this.$=d.prepareBlock(f[g-3],f[g-2],f[g-1],f[g],!0,this._$);break;case 13:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 14:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 15:this.$={strip:d.stripFlags(f[g-1],f[g-1]),program:f[g]};break;case 16:this.$={path:f[g-1],strip:d.stripFlags(f[g-2],f[g])};break;case 17:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 18:this.$=new d.MustacheNode(f[g-1],null,f[g-2],d.stripFlags(f[g-2],f[g]),this._$);break;case 19:this.$=new d.PartialNode(f[g-3],f[g-2],f[g-1],d.stripFlags(f[g-4],f[g]),this._$);break;case 20:this.$=new d.PartialNode(f[g-2],void 0,f[g-1],d.stripFlags(f[g-3],f[g]),this._$);break;case 21:this.$=new d.SexprNode([f[g-2]].concat(f[g-1]),f[g],this._$);break;case 22:this.$=new d.SexprNode([f[g]],null,this._$);break;case 23:this.$=f[g];break;case 24:this.$=new d.StringNode(f[g],this._$);break;case 25:this.$=new d.NumberNode(f[g],this._$);break;case 26:this.$=new d.BooleanNode(f[g],this._$);break;case 27:this.$=f[g];break;case 28:f[g-1].isHelper=!0,this.$=f[g-1];break;case 29:this.$=new d.HashNode(f[g],this._$);break;case 30:this.$=[f[g-2],f[g]];break;case 31:this.$=new d.PartialNameNode(f[g],this._$);break;case 32:this.$=new d.PartialNameNode(new d.StringNode(f[g],this._$),this._$);break;case 33:this.$=new d.PartialNameNode(new d.NumberNode(f[g],this._$));break;case 34:this.$=new d.DataNode(f[g],this._$);break;case 35:this.$=new d.IdNode(f[g],this._$);break;case 36:f[g-2].push({part:f[g],separator:f[g-1]}),this.$=f[g-2];break;case 37:this.$=[{part:f[g]}];break;case 38:this.$=[];break;case 39:f[g-1].push(f[g]);break;case 48:this.$=[];break;case 49:f[g-1].push(f[g]);break;case 52:this.$=[f[g]];break;case 53:f[g-1].push(f[g])}},table:[{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],defaultActions:{4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},parseError:function(a){throw new Error(a)},parse:function(a){function b(){var a;return a=c.lexer.lex()||1,"number"!=typeof a&&(a=c.symbols_[a]||a),a}var c=this,d=[0],e=[null],f=[],g=this.table,h="",i=0,j=0,k=0;this.lexer.setInput(a),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var l=this.lexer.yylloc;f.push(l);var m=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var n,o,p,q,r,s,t,u,v,w={};;){if(p=d[d.length-1],this.defaultActions[p]?q=this.defaultActions[p]:((null===n||"undefined"==typeof n)&&(n=b()),q=g[p]&&g[p][n]),"undefined"==typeof q||!q.length||!q[0]){var x="";if(!k){v=[];for(s in g[p])this.terminals_[s]&&s>2&&v.push("'"+this.terminals_[s]+"'");x=this.lexer.showPosition?"Parse error on line "+(i+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+v.join(", ")+", got '"+(this.terminals_[n]||n)+"'":"Parse error on line "+(i+1)+": Unexpected "+(1==n?"end of input":"'"+(this.terminals_[n]||n)+"'"),this.parseError(x,{text:this.lexer.match,token:this.terminals_[n]||n,line:this.lexer.yylineno,loc:l,expected:v})}}if(q[0]instanceof Array&&q.length>1)throw new Error("Parse Error: multiple actions possible at state: "+p+", token: "+n);switch(q[0]){case 1:d.push(n),e.push(this.lexer.yytext),f.push(this.lexer.yylloc),d.push(q[1]),n=null,o?(n=o,o=null):(j=this.lexer.yyleng,h=this.lexer.yytext,i=this.lexer.yylineno,l=this.lexer.yylloc,k>0&&k--);break;case 2:if(t=this.productions_[q[1]][1],w.$=e[e.length-t],w._$={first_line:f[f.length-(t||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(t||1)].first_column,last_column:f[f.length-1].last_column},m&&(w._$.range=[f[f.length-(t||1)].range[0],f[f.length-1].range[1]]),r=this.performAction.call(w,h,j,i,this.yy,q[1],e,f),"undefined"!=typeof r)return r;t&&(d=d.slice(0,-1*t*2),e=e.slice(0,-1*t),f=f.slice(0,-1*t)),d.push(this.productions_[q[1]][0]),e.push(w.$),f.push(w._$),u=g[d[d.length-2]][d[d.length-1]],d.push(u);break;case 3:return!0}}return!0}},c=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a){return this._input=a,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b-1),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this},more:function(){return this._more=!0,this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d,e;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),g=0;g<f.length&&(c=this._input.match(this.rules[f[g]]),!c||b&&!(c[0].length>b[0].length)||(b=c,d=g,this.options.flex));g++);return b?(e=b[0].match(/(?:\r\n?|\n).*/g),e&&(this.yylineno+=e.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:e?e[e.length-1].length-e[e.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],a=this.performAction.call(this,this.yy,this,f[d],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),a?a:void 0):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return"undefined"!=typeof a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(a){this.begin(a)}};return a.options={},a.performAction=function(a,b,c,d){function e(a,c){return b.yytext=b.yytext.substr(a,b.yyleng-c)}switch(c){case 0:if("\\\\"===b.yytext.slice(-2)?(e(0,1),this.begin("mu")):"\\"===b.yytext.slice(-1)?(e(0,1),this.begin("emu")):this.begin("mu"),b.yytext)return 12;break;case 1:return 12;case 2:return this.popState(),12;case 3:return b.yytext=b.yytext.substr(5,b.yyleng-9),this.popState(),15;case 4:return 12;case 5:return e(0,4),this.popState(),13;case 6:return 45;case 7:return 46;case 8:return 16;case 9:return this.popState(),this.begin("raw"),18;case 10:return 34;case 11:return 24;case 12:return 29;case 13:return this.popState(),28;case 14:return this.popState(),28;case 15:return 26;case 16:return 26;case 17:return 32;case 18:return 31;case 19:this.popState(),this.begin("com");break;case 20:return e(3,5),this.popState(),13;case 21:return 31;case 22:return 51;case 23:return 50;case 24:return 50;case 25:return 54;case 26:break;case 27:return this.popState(),33;case 28:return this.popState(),25;case 29:return b.yytext=e(1,2).replace(/\\"/g,'"'),42;case 30:return b.yytext=e(1,2).replace(/\\'/g,"'"),42;case 31:return 52;case 32:return 44;case 33:return 44;case 34:return 43;case 35:return 50;case 36:return b.yytext=e(1,2),50;case 37:return"INVALID";case 38:return 5}},a.rules=[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],a.conditions={mu:{rules:[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[5],inclusive:!1},raw:{rules:[3,4],inclusive:!1},INITIAL:{rules:[0,1,38],inclusive:!0}},a}();return b.lexer=c,a.prototype=b,b.Parser=a,new a}();return a=b}(),i=function(a){"use strict";function b(a,b){return{left:"~"===a.charAt(2),right:"~"===b.charAt(b.length-3)}}function c(a,b,c,d,i,k){if(a.sexpr.id.original!==d.path.original)throw new j(a.sexpr.id.original+" doesn't match "+d.path.original,a);var l=c&&c.program,m={left:a.strip.left,right:d.strip.right,openStandalone:f(b.statements),closeStandalone:e((l||b).statements)};if(a.strip.right&&g(b.statements,null,!0),l){var n=c.strip;n.left&&h(b.statements,null,!0),n.right&&g(l.statements,null,!0),d.strip.left&&h(l.statements,null,!0),e(b.statements)&&f(l.statements)&&(h(b.statements),g(l.statements))}else d.strip.left&&h(b.statements,null,!0);return i?new this.BlockNode(a,l,b,m,k):new this.BlockNode(a,b,l,m,k)}function d(a,b){for(var c=0,d=a.length;d>c;c++){var i=a[c],j=i.strip;if(j){var k=e(a,c,b,"partial"===i.type),l=f(a,c,b),m=j.openStandalone&&k,n=j.closeStandalone&&l,o=j.inlineStandalone&&k&&l;j.right&&g(a,c,!0),j.left&&h(a,c,!0),o&&(g(a,c),h(a,c)&&"partial"===i.type&&(i.indent=/([ \t]+$)/.exec(a[c-1].original)?RegExp.$1:"")),m&&(g((i.program||i.inverse).statements),h(a,c)),n&&(g(a,c),h((i.inverse||i.program).statements))}}return a}function e(a,b,c){void 0===b&&(b=a.length);var d=a[b-1],e=a[b-2];return d?"content"===d.type?(e||!c?/\r?\n\s*?$/:/(^|\r?\n)\s*?$/).test(d.original):void 0:c}function f(a,b,c){void 0===b&&(b=-1);var d=a[b+1],e=a[b+2];return d?"content"===d.type?(e||!c?/^\s*?\r?\n/:/^\s*?(\r?\n|$)/).test(d.original):void 0:c}function g(a,b,c){var d=a[null==b?0:b+1];if(d&&"content"===d.type&&(c||!d.rightStripped)){var e=d.string;d.string=d.string.replace(c?/^\s+/:/^[ \t]*\r?\n?/,""),d.rightStripped=d.string!==e}}function h(a,b,c){var d=a[null==b?a.length-1:b-1];if(d&&"content"===d.type&&(c||!d.leftStripped)){var e=d.string;return d.string=d.string.replace(c?/\s+$/:/[ \t]+$/,""),d.leftStripped=d.string!==e,d.leftStripped}}var i={},j=a;return i.stripFlags=b,i.prepareBlock=c,i.prepareProgram=d,i}(c),j=function(a,b,c,d){"use strict";function e(a){return a.constructor===h.ProgramNode?a:(g.yy=k,g.parse(a))}var f={},g=a,h=b,i=c,j=d.extend;f.parser=g;var k={};return j(k,i,h),f.parse=e,f}(h,g,i,b),k=function(a,b){"use strict";function c(){}function d(a,b,c){if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var d=c.parse(a),e=(new c.Compiler).compile(d,b);return(new c.JavaScriptCompiler).compile(e,b)}function e(a,b,c){function d(){var d=c.parse(a),e=(new c.Compiler).compile(d,b),f=(new c.JavaScriptCompiler).compile(e,b,void 0,!0);return c.template(f)}if(null==a||"string"!=typeof a&&a.constructor!==c.AST.ProgramNode)throw new h("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+a);b=b||{},"data"in b||(b.data=!0),b.compat&&(b.useDepths=!0);var e,f=function(a,b){return e||(e=d()),e.call(this,a,b)};return f._setup=function(a){return e||(e=d()),e._setup(a)},f._child=function(a,b,c){return e||(e=d()),e._child(a,b,c)},f}function f(a,b){if(a===b)return!0;if(i(a)&&i(b)&&a.length===b.length){for(var c=0;c<a.length;c++)if(!f(a[c],b[c]))return!1;return!0}}var g={},h=a,i=b.isArray,j=[].slice;return g.Compiler=c,c.prototype={compiler:c,equals:function(a){var b=this.opcodes.length;if(a.opcodes.length!==b)return!1;for(var c=0;b>c;c++){var d=this.opcodes[c],e=a.opcodes[c];if(d.opcode!==e.opcode||!f(d.args,e.args))return!1}for(b=this.children.length,c=0;b>c;c++)if(!this.children[c].equals(a.children[c]))return!1;return!0},guid:0,compile:function(a,b){this.opcodes=[],this.children=[],this.depths={list:[]},this.options=b,this.stringParams=b.stringParams,this.trackIds=b.trackIds;var c=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0,lookup:!0},c)for(var d in c)this.options.knownHelpers[d]=c[d];return this.accept(a)},accept:function(a){return this[a.type](a)},program:function(a){for(var b=a.statements,c=0,d=b.length;d>c;c++)this.accept(b[c]);return this.isSimple=1===d,this.depths.list=this.depths.list.sort(function(a,b){return a-b}),this},compileProgram:function(a){var b,c=(new this.compiler).compile(a,this.options),d=this.guid++; | ||
this.usePartial=this.usePartial||c.usePartial,this.children[d]=c;for(var e=0,f=c.depths.list.length;f>e;e++)b=c.depths.list[e],2>b||this.addDepth(b-1);return d},block:function(a){var b=a.mustache,c=a.program,d=a.inverse;c&&(c=this.compileProgram(c)),d&&(d=this.compileProgram(d));var e=b.sexpr,f=this.classifySexpr(e);"helper"===f?this.helperSexpr(e,c,d):"simple"===f?(this.simpleSexpr(e),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("blockValue",e.id.original)):(this.ambiguousSexpr(e,c,d),this.opcode("pushProgram",c),this.opcode("pushProgram",d),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(a){var b,c,d=a.pairs;for(this.opcode("pushHash"),b=0,c=d.length;c>b;b++)this.pushParam(d[b][1]);for(;b--;)this.opcode("assignToHash",d[b][0]);this.opcode("popHash")},partial:function(a){var b=a.partialName;this.usePartial=!0,a.hash?this.accept(a.hash):this.opcode("push","undefined"),a.context?this.accept(a.context):(this.opcode("getContext",0),this.opcode("pushContext")),this.opcode("invokePartial",b.name,a.indent||""),this.opcode("append")},content:function(a){a.string&&this.opcode("appendContent",a.string)},mustache:function(a){this.sexpr(a.sexpr),a.escaped&&!this.options.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousSexpr:function(a,b,c){var d=a.id,e=d.parts[0],f=null!=b||null!=c;this.opcode("getContext",d.depth),this.opcode("pushProgram",b),this.opcode("pushProgram",c),this.ID(d),this.opcode("invokeAmbiguous",e,f)},simpleSexpr:function(a){var b=a.id;"DATA"===b.type?this.DATA(b):b.parts.length?this.ID(b):(this.addDepth(b.depth),this.opcode("getContext",b.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperSexpr:function(a,b,c){var d=this.setupFullMustacheParams(a,b,c),e=a.id,f=e.parts[0];if(this.options.knownHelpers[f])this.opcode("invokeKnownHelper",d.length,f);else{if(this.options.knownHelpersOnly)throw new h("You specified knownHelpersOnly, but used the unknown helper "+f,a);e.falsy=!0,this.ID(e),this.opcode("invokeHelper",d.length,e.original,e.isSimple)}},sexpr:function(a){var b=this.classifySexpr(a);"simple"===b?this.simpleSexpr(a):"helper"===b?this.helperSexpr(a):this.ambiguousSexpr(a)},ID:function(a){this.addDepth(a.depth),this.opcode("getContext",a.depth);var b=a.parts[0];b?this.opcode("lookupOnContext",a.parts,a.falsy,a.isScoped):this.opcode("pushContext")},DATA:function(a){this.options.data=!0,this.opcode("lookupData",a.id.depth,a.id.parts)},STRING:function(a){this.opcode("pushString",a.string)},NUMBER:function(a){this.opcode("pushLiteral",a.number)},BOOLEAN:function(a){this.opcode("pushLiteral",a.bool)},comment:function(){},opcode:function(a){this.opcodes.push({opcode:a,args:j.call(arguments,1)})},addDepth:function(a){0!==a&&(this.depths[a]||(this.depths[a]=!0,this.depths.list.push(a)))},classifySexpr:function(a){var b=a.isHelper,c=a.eligibleHelper,d=this.options;if(c&&!b){var e=a.id.parts[0];d.knownHelpers[e]?b=!0:d.knownHelpersOnly&&(c=!1)}return b?"helper":c?"ambiguous":"simple"},pushParams:function(a){for(var b=0,c=a.length;c>b;b++)this.pushParam(a[b])},pushParam:function(a){this.stringParams?(a.depth&&this.addDepth(a.depth),this.opcode("getContext",a.depth||0),this.opcode("pushStringParam",a.stringModeValue,a.type),"sexpr"===a.type&&this.sexpr(a)):(this.trackIds&&this.opcode("pushId",a.type,a.idName||a.stringModeValue),this.accept(a))},setupFullMustacheParams:function(a,b,c){var d=a.params;return this.pushParams(d),this.opcode("pushProgram",b),this.opcode("pushProgram",c),a.hash?this.hash(a.hash):this.opcode("emptyHash"),d}},g.precompile=d,g.compile=e,g}(c,b),l=function(a,b){"use strict";function c(a){this.value=a}function d(){}var e,f=a.COMPILER_REVISION,g=a.REVISION_CHANGES,h=b;d.prototype={nameLookup:function(a,b){return d.isValidJavaScriptVariableName(b)?a+"."+b:a+"['"+b+"']"},depthedLookup:function(a){return this.aliases.lookup="this.lookup",'lookup(depths, "'+a+'")'},compilerInfo:function(){var a=f,b=g[a];return[a,b]},appendToBuffer:function(a){return this.environment.isSimple?"return "+a+";":{appendToBuffer:!0,content:a,toString:function(){return"buffer += "+a+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(a,b,c,d){this.environment=a,this.options=b,this.stringParams=this.options.stringParams,this.trackIds=this.options.trackIds,this.precompile=!d,this.name=this.environment.name,this.isChild=!!c,this.context=c||{programs:[],environments:[]},this.preamble(),this.stackSlot=0,this.stackVars=[],this.aliases={},this.registers={list:[]},this.hashes=[],this.compileStack=[],this.inlineStack=[],this.compileChildren(a,b),this.useDepths=this.useDepths||a.depths.list.length||this.options.compat;var e,f,g,i=a.opcodes;for(f=0,g=i.length;g>f;f++)e=i[f],this[e.opcode].apply(this,e.args);if(this.pushSource(""),this.stackSlot||this.inlineStack.length||this.compileStack.length)throw new h("Compile completed with content left on stack");var j=this.createFunctionContext(d);if(this.isChild)return j;var k={compiler:this.compilerInfo(),main:j},l=this.context.programs;for(f=0,g=l.length;g>f;f++)l[f]&&(k[f]=l[f]);return this.environment.usePartial&&(k.usePartial=!0),this.options.data&&(k.useData=!0),this.useDepths&&(k.useDepths=!0),this.options.compat&&(k.compat=!0),d||(k.compiler=JSON.stringify(k.compiler),k=this.objectLiteral(k)),k},preamble:function(){this.lastContext=0,this.source=[]},createFunctionContext:function(a){var b="",c=this.stackVars.concat(this.registers.list);c.length>0&&(b+=", "+c.join(", "));for(var d in this.aliases)this.aliases.hasOwnProperty(d)&&(b+=", "+d+"="+this.aliases[d]);var e=["depth0","helpers","partials","data"];this.useDepths&&e.push("depths");var f=this.mergeSource(b);return a?(e.push(f),Function.apply(this,e)):"function("+e.join(",")+") {\n "+f+"}"},mergeSource:function(a){for(var b,c,d="",e=!this.forceBuffer,f=0,g=this.source.length;g>f;f++){var h=this.source[f];h.appendToBuffer?b=b?b+"\n + "+h.content:h.content:(b&&(d?d+="buffer += "+b+";\n ":(c=!0,d=b+";\n "),b=void 0),d+=h+"\n ",this.environment.isSimple||(e=!1))}return e?(b||!d)&&(d+="return "+(b||'""')+";\n"):(a+=", buffer = "+(c?"":this.initializeBuffer()),d+=b?"return buffer + "+b+";\n":"return buffer;\n"),a&&(d="var "+a.substring(2)+(c?"":";\n ")+d),d},blockValue:function(a){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var b=[this.contextName(0)];this.setupParams(a,0,b);var c=this.popStack();b.splice(1,0,c),this.push("blockHelperMissing.call("+b.join(", ")+")")},ambiguousBlockValue:function(){this.aliases.blockHelperMissing="helpers.blockHelperMissing";var a=[this.contextName(0)];this.setupParams("",0,a,!0),this.flushInline();var b=this.topStack();a.splice(1,0,b),this.pushSource("if (!"+this.lastHelper+") { "+b+" = blockHelperMissing.call("+a.join(", ")+"); }")},appendContent:function(a){this.pendingContent&&(a=this.pendingContent+a),this.pendingContent=a},append:function(){this.flushInline();var a=this.popStack();this.pushSource("if ("+a+" != null) { "+this.appendToBuffer(a)+" }"),this.environment.isSimple&&this.pushSource("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.aliases.escapeExpression="this.escapeExpression",this.pushSource(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(a){this.lastContext=a},pushContext:function(){this.pushStackLiteral(this.contextName(this.lastContext))},lookupOnContext:function(a,b,c){var d=0,e=a.length;for(c||!this.options.compat||this.lastContext?this.pushContext():this.push(this.depthedLookup(a[d++]));e>d;d++)this.replaceStack(function(c){var e=this.nameLookup(c,a[d],"context");return b?" && "+e:" != null ? "+e+" : "+c})},lookupData:function(a,b){a?this.pushStackLiteral("this.data(data, "+a+")"):this.pushStackLiteral("data");for(var c=b.length,d=0;c>d;d++)this.replaceStack(function(a){return" && "+this.nameLookup(a,b[d],"data")})},resolvePossibleLambda:function(){this.aliases.lambda="this.lambda",this.push("lambda("+this.popStack()+", "+this.contextName(0)+")")},pushStringParam:function(a,b){this.pushContext(),this.pushString(b),"sexpr"!==b&&("string"==typeof a?this.pushString(a):this.pushStackLiteral(a))},emptyHash:function(){this.pushStackLiteral("{}"),this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}"))},pushHash:function(){this.hash&&this.hashes.push(this.hash),this.hash={values:[],types:[],contexts:[],ids:[]}},popHash:function(){var a=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push("{"+a.ids.join(",")+"}"),this.stringParams&&(this.push("{"+a.contexts.join(",")+"}"),this.push("{"+a.types.join(",")+"}")),this.push("{\n "+a.values.join(",\n ")+"\n }")},pushString:function(a){this.pushStackLiteral(this.quotedString(a))},push:function(a){return this.inlineStack.push(a),a},pushLiteral:function(a){this.pushStackLiteral(a)},pushProgram:function(a){null!=a?this.pushStackLiteral(this.programExpression(a)):this.pushStackLiteral(null)},invokeHelper:function(a,b,c){this.aliases.helperMissing="helpers.helperMissing";var d=this.popStack(),e=this.setupHelper(a,b),f=(c?e.name+" || ":"")+d+" || helperMissing";this.push("(("+f+").call("+e.callParams+"))")},invokeKnownHelper:function(a,b){var c=this.setupHelper(a,b);this.push(c.name+".call("+c.callParams+")")},invokeAmbiguous:function(a,b){this.aliases.functionType='"function"',this.aliases.helperMissing="helpers.helperMissing",this.useRegister("helper");var c=this.popStack();this.emptyHash();var d=this.setupHelper(0,a,b),e=this.lastHelper=this.nameLookup("helpers",a,"helper");this.push("((helper = (helper = "+e+" || "+c+") != null ? helper : helperMissing"+(d.paramsInit?"),("+d.paramsInit:"")+"),(typeof helper === functionType ? helper.call("+d.callParams+") : helper))")},invokePartial:function(a,b){var c=[this.nameLookup("partials",a,"partial"),"'"+b+"'","'"+a+"'",this.popStack(),this.popStack(),"helpers","partials"];this.options.data?c.push("data"):this.options.compat&&c.push("undefined"),this.options.compat&&c.push("depths"),this.push("this.invokePartial("+c.join(", ")+")")},assignToHash:function(a){var b,c,d,e=this.popStack();this.trackIds&&(d=this.popStack()),this.stringParams&&(c=this.popStack(),b=this.popStack());var f=this.hash;b&&f.contexts.push("'"+a+"': "+b),c&&f.types.push("'"+a+"': "+c),d&&f.ids.push("'"+a+"': "+d),f.values.push("'"+a+"': ("+e+")")},pushId:function(a,b){"ID"===a||"DATA"===a?this.pushString(b):"sexpr"===a?this.pushStackLiteral("true"):this.pushStackLiteral("null")},compiler:d,compileChildren:function(a,b){for(var c,d,e=a.children,f=0,g=e.length;g>f;f++){c=e[f],d=new this.compiler;var h=this.matchExistingProgram(c);null==h?(this.context.programs.push(""),h=this.context.programs.length,c.index=h,c.name="program"+h,this.context.programs[h]=d.compile(c,b,this.context,!this.precompile),this.context.environments[h]=c,this.useDepths=this.useDepths||d.useDepths):(c.index=h,c.name="program"+h)}},matchExistingProgram:function(a){for(var b=0,c=this.context.environments.length;c>b;b++){var d=this.context.environments[b];if(d&&d.equals(a))return b}},programExpression:function(a){var b=this.environment.children[a],c=(b.depths.list,this.useDepths),d=[b.index,"data"];return c&&d.push("depths"),"this.program("+d.join(", ")+")"},useRegister:function(a){this.registers[a]||(this.registers[a]=!0,this.registers.list.push(a))},pushStackLiteral:function(a){return this.push(new c(a))},pushSource:function(a){this.pendingContent&&(this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent))),this.pendingContent=void 0),a&&this.source.push(a)},pushStack:function(a){this.flushInline();var b=this.incrStack();return this.pushSource(b+" = "+a+";"),this.compileStack.push(b),b},replaceStack:function(a){{var b,d,e,f="";this.isInline()}if(!this.isInline())throw new h("replaceStack on non-inline");var g=this.popStack(!0);if(g instanceof c)f=b=g.value,e=!0;else{d=!this.stackSlot;var i=d?this.incrStack():this.topStackName();f="("+this.push(i)+" = "+g+")",b=this.topStack()}var j=a.call(this,b);e||this.popStack(),d&&this.stackSlot--,this.push("("+f+j+")")},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var a=this.inlineStack;if(a.length){this.inlineStack=[];for(var b=0,d=a.length;d>b;b++){var e=a[b];e instanceof c?this.compileStack.push(e):this.pushStack(e)}}},isInline:function(){return this.inlineStack.length},popStack:function(a){var b=this.isInline(),d=(b?this.inlineStack:this.compileStack).pop();if(!a&&d instanceof c)return d.value;if(!b){if(!this.stackSlot)throw new h("Invalid stack pop");this.stackSlot--}return d},topStack:function(){var a=this.isInline()?this.inlineStack:this.compileStack,b=a[a.length-1];return b instanceof c?b.value:b},contextName:function(a){return this.useDepths&&a?"depths["+a+"]":"depth"+a},quotedString:function(a){return'"'+a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},objectLiteral:function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(this.quotedString(c)+":"+a[c]);return"{"+b.join(",")+"}"},setupHelper:function(a,b,c){var d=[],e=this.setupParams(b,a,d,c),f=this.nameLookup("helpers",b,"helper");return{params:d,paramsInit:e,name:f,callParams:[this.contextName(0)].concat(d).join(", ")}},setupOptions:function(a,b,c){var d,e,f,g={},h=[],i=[],j=[];g.name=this.quotedString(a),g.hash=this.popStack(),this.trackIds&&(g.hashIds=this.popStack()),this.stringParams&&(g.hashTypes=this.popStack(),g.hashContexts=this.popStack()),e=this.popStack(),f=this.popStack(),(f||e)&&(f||(f="this.noop"),e||(e="this.noop"),g.fn=f,g.inverse=e);for(var k=b;k--;)d=this.popStack(),c[k]=d,this.trackIds&&(j[k]=this.popStack()),this.stringParams&&(i[k]=this.popStack(),h[k]=this.popStack());return this.trackIds&&(g.ids="["+j.join(",")+"]"),this.stringParams&&(g.types="["+i.join(",")+"]",g.contexts="["+h.join(",")+"]"),this.options.data&&(g.data="data"),g},setupParams:function(a,b,c,d){var e=this.objectLiteral(this.setupOptions(a,b,c));return d?(this.useRegister("options"),c.push("options"),"options="+e):(c.push(e),"")}};for(var i="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),j=d.RESERVED_WORDS={},k=0,l=i.length;l>k;k++)j[i[k]]=!0;return d.isValidJavaScriptVariableName=function(a){return!d.RESERVED_WORDS[a]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(a)},e=d}(d,c),m=function(a,b,c,d,e){"use strict";var f,g=a,h=b,i=c.parser,j=c.parse,k=d.Compiler,l=d.compile,m=d.precompile,n=e,o=g.create,p=function(){var a=o();return a.compile=function(b,c){return l(b,c,a)},a.precompile=function(b,c){return m(b,c,a)},a.AST=h,a.Compiler=k,a.JavaScriptCompiler=n,a.Parser=i,a.parse=j,a};return g=p(),g.create=p,g["default"]=g,f=g}(f,g,j,k,l);return m}); |
/* | ||
RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. | ||
RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. | ||
Available via the MIT or new BSD license. | ||
@@ -32,6 +32,6 @@ see: http://github.com/jrburke/requirejs for details | ||
Y="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),F={},q={},R=[],M=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(G(requirejs))return;q=requirejs;requirejs=void 0}"undefined"!==typeof require&&!G(require)&&(q=require,require=void 0);g=requirejs=function(b,c,d,e){var n,p="_";!H(b)&&"string"!==typeof b&&(n=b,H(c)?(b=c,c=d,d=e):b=[]);n&&n.context&&(p=n.context);(e=m(F,p))||(e=F[p]=g.s.newContext(p));n&&e.configure(n);return e.require(b,c,d)};g.config=function(b){return g(b)}; | ||
g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.1.14";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=z;x=g.s={contexts:F,newContext:ga};g({});v(["toUrl","undef","defined","specified"],function(b){g[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;g.onError=ca;g.createNode=function(b){var c= | ||
g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.1.15";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=z;x=g.s={contexts:F,newContext:ga};g({});v(["toUrl","undef","defined","specified"],function(b){g[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;g.onError=ca;g.createNode=function(b){var c= | ||
b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};g.load=function(b,c,d){var e=b&&b.config||{};if(z)return e=g.createNode(e,c,d),e.setAttribute("data-requirecontext",b.contextName),e.setAttribute("data-requiremodule",c),e.attachEvent&&!(e.attachEvent.toString&&0>e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)): | ||
(e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl= | ||
O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b|| | ||
(b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this); | ||
(b=e.getAttribute("data-requiremodule")),g=F[e.getAttribute("data-requirecontext")])}(g?g.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};g.exec=function(b){return eval(b)};g(q)}})(this); |
@@ -6,6 +6,6 @@ /** | ||
// Node Module | ||
var should = require("should"); | ||
var fs = require("fs"); | ||
var sys = require("sys"); | ||
var exec = require("child_process").exec; | ||
var should = require('should'); | ||
var fs = require('fs'); | ||
var sys = require('sys'); | ||
var exec = require('child_process').exec; | ||
@@ -15,67 +15,71 @@ /* -------------------------------------------------------------------------------- | ||
* -------------------------------------------------------------------------------- */ | ||
describe("apiDoc", function() { | ||
describe('apiDoc full example', function() { | ||
var fixtureFiles = [ | ||
"api_data.js", | ||
"api_data.json", | ||
"api_project.js", | ||
"api_project.json", | ||
"index.html" | ||
]; | ||
var fixtureFiles = [ | ||
'api_data.js', | ||
'api_data.json', | ||
'api_project.js', | ||
'api_project.json', | ||
'index.html' | ||
]; | ||
before(function(done) { | ||
done(); | ||
}); | ||
before(function(done) { | ||
done(); | ||
}); | ||
after(function(done) { | ||
done(); | ||
}); | ||
after(function(done) { | ||
done(); | ||
}); | ||
// create | ||
it("case 1: should create example in tmp/", function(done) { | ||
exec("node ./bin/apidoc -i test/fixtures/example/ -o tmp/ -t test/template/", function(err, stdout, stderr) { | ||
if(err) throw err; | ||
if(stderr) throw stderr; | ||
done(); | ||
}); | ||
}); // it | ||
// create | ||
it('case 1: should create example in tmp/', function(done) { | ||
exec('node ./bin/apidoc -i test/fixtures/example/ -o tmp/ -t test/template/ --silent', function(err, stdout, stderr) { | ||
if (err) | ||
throw err; | ||
// check | ||
it("case 1: should find created files", function(done) { | ||
fixtureFiles.forEach(function(name) { | ||
fs.existsSync("./tmp/" + name).should.eql(true); | ||
}); | ||
done(); | ||
}); // it | ||
if (stderr) | ||
throw stderr; | ||
// compare | ||
it("case 1: created files should equal to fixtures", function(done) { | ||
var timeRegExp = /"time"\:\s"(.*)"/g; | ||
var versionRegExp = /"version"\:\s"(.*)"/g; | ||
fixtureFiles.forEach(function(name) { | ||
var fixtureContent = fs.readFileSync("test/fixtures/" + name, "utf8"); | ||
var createdContent = fs.readFileSync("./tmp/" + name, "utf8"); | ||
done(); | ||
}); | ||
}); | ||
// creation time remove (never equal) | ||
fixtureContent = fixtureContent.replace(timeRegExp, ""); | ||
createdContent = createdContent.replace(timeRegExp, ""); | ||
// check | ||
it('case 1: should find created files', function(done) { | ||
fixtureFiles.forEach(function(name) { | ||
fs.existsSync('./tmp/' + name).should.eql(true); | ||
}); | ||
done(); | ||
}); | ||
// creation time remove (or fixtures must be updated every time the version change) | ||
fixtureContent = fixtureContent.replace(versionRegExp, ""); | ||
createdContent = createdContent.replace(versionRegExp, ""); | ||
// compare | ||
it('case 1: created files should equal to fixtures', function(done) { | ||
var timeRegExp = /\"time\"\:\s\"(.*)\"/g; | ||
var versionRegExp = /\"version\"\:\s\"(.*)\"/g; | ||
fixtureFiles.forEach(function(name) { | ||
var fixtureContent = fs.readFileSync('test/fixtures/' + name, 'utf8'); | ||
var createdContent = fs.readFileSync('./tmp/' + name, 'utf8'); | ||
var fixtureLines = fixtureContent.split(/\r\n/); | ||
var createdLines = createdContent.split(/\r\n/); | ||
// creation time remove (never equal) | ||
fixtureContent = fixtureContent.replace(timeRegExp, ''); | ||
createdContent = createdContent.replace(timeRegExp, ''); | ||
if (fixtureLines.length !== createdLines.length) | ||
throw new Error("File ./tmp/" + name + " not equals to test/fixutres/" + name); | ||
// creation time remove (or fixtures must be updated every time the version change) | ||
fixtureContent = fixtureContent.replace(versionRegExp, ''); | ||
createdContent = createdContent.replace(versionRegExp, ''); | ||
for (var lineNumber = 0; lineNumber < fixtureLines.length; lineNumber += 1) { | ||
if (fixtureLines[lineNumber] !== createdLines[lineNumber]) | ||
throw new Error("File ./tmp/" + name + " not equals to test/fixutres/" + name + " in line " + (lineNumber + 1)); | ||
} // for | ||
}); | ||
done(); | ||
}); // it | ||
var fixtureLines = fixtureContent.split(/\r\n/); | ||
var createdLines = createdContent.split(/\r\n/); | ||
}); // describe | ||
if (fixtureLines.length !== createdLines.length) | ||
throw new Error('File ./tmp/' + name + ' not equals to test/fixutres/' + name); | ||
for (var lineNumber = 0; lineNumber < fixtureLines.length; lineNumber += 1) { | ||
if (fixtureLines[lineNumber] !== createdLines[lineNumber]) | ||
throw new Error('File ./tmp/' + name + ' not equals to test/fixutres/' + name + ' in line ' + (lineNumber + 1)); | ||
} | ||
}); | ||
done(); | ||
}); | ||
}); |
define({ api: [ | ||
{ | ||
"type": "get", | ||
"url": "/define", | ||
"title": "Define", | ||
"name": "GetDefine", | ||
"group": "Define", | ||
"version": "0.8.0", | ||
"description": "<p>Example of @apiDefine and @apiUse</p> ", | ||
"parameter": { | ||
"fields": { | ||
"Parameter": [ | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field3", | ||
"description": "<p>This is Field 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field1", | ||
"description": "<p>This is Field 1.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field2", | ||
"description": "<p>This is Field 2.</p> " | ||
} | ||
] | ||
} | ||
}, | ||
"filename": "test/fixtures/example/define.js", | ||
"groupTitle": "Define", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/define" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
@@ -9,3 +49,3 @@ "url": "/test/error", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple ErrorStructures.</p>", | ||
"description": "<p>Use of multiple ErrorStructures.</p> ", | ||
"error": { | ||
@@ -16,17 +56,17 @@ "fields": { | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error3Error", | ||
"optional": false, | ||
"description": "<p>This is Error 3 (local).</p>" | ||
"description": "<p>This is Error 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error1Error", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
"description": "<p>This is Error 1.</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error2Error", | ||
"optional": false, | ||
"description": "<p>This is Error 2.</p>" | ||
"description": "<p>This is Error 2.</p> " | ||
} | ||
@@ -36,3 +76,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/error_structure.js" | ||
"filename": "test/fixtures/example/error_structure.js", | ||
"groupTitle": "Error", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/error" | ||
} | ||
] | ||
}, | ||
@@ -46,3 +92,3 @@ { | ||
"version": "0.1.0", | ||
"description": "<p>Use of Title and Structures in the same block.</p>", | ||
"description": "<p>Use of Title and Structures in the same block.</p> ", | ||
"success": { | ||
@@ -53,5 +99,5 @@ "fields": { | ||
"group": "204", | ||
"optional": false, | ||
"field": "message", | ||
"optional": false, | ||
"description": "<p>Successfully deleted.</p>" | ||
"description": "<p>Successfully deleted.</p> " | ||
} | ||
@@ -66,11 +112,11 @@ ] | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error3Error", | ||
"optional": false, | ||
"description": "<p>This is Error 3 (local).</p>" | ||
"description": "<p>This is Error 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error1Error", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
"description": "<p>This is Error 1.</p> " | ||
} | ||
@@ -80,3 +126,8 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/title_and_structure.js" | ||
"groupTitle": "Error", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/title_and_error" | ||
} | ||
] | ||
}, | ||
@@ -90,7 +141,7 @@ { | ||
"version": "0.6.0", | ||
"description": "<p>Escape Example data.</p>", | ||
"description": "<p>Escape Example data.</p> ", | ||
"examples": [ | ||
{ | ||
"title": "Example usage:", | ||
"content": "Example usage:\n curl -i http://localhost/escape/text\n <b>curl -i http://localhost/escape/html</b>\n <xml>curl -i http://localhost/escape/xml</xml>\n", | ||
"content": " curl -i http://localhost/escape/text\n <b>curl -i http://localhost/escape/html</b>\n <xml>curl -i http://localhost/escape/xml</xml>\n", | ||
"type": "json" | ||
@@ -103,3 +154,3 @@ } | ||
"title": "Example Response", | ||
"content": "Example Response\nHTTP/1.1 200 OK {\n field_text: 'text-value',\n field_html: '<b>html-value</b>',\n field_xml: '<xml>xml-value</xml>'\n}\n", | ||
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value',\n field_html: '<b>html-value</b>',\n field_xml: '<xml>xml-value</xml>'\n}\n", | ||
"type": "json" | ||
@@ -109,3 +160,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/escape.js" | ||
"filename": "test/fixtures/example/escape.js", | ||
"groupTitle": "Escape", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/escape" | ||
} | ||
] | ||
}, | ||
@@ -119,7 +176,7 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Escape Example data - with comparison.</p>", | ||
"description": "<p>Escape Example data - with comparison.</p> ", | ||
"examples": [ | ||
{ | ||
"title": "Example usage:", | ||
"content": "Example usage:\n curl -i http://localhost/escape/text-old\n <b>curl -i http://localhost/escape/html-old</b>\n <xml>curl -i http://localhost/escape/xml-old</xml>\n", | ||
"content": " curl -i http://localhost/escape/text-old\n <b>curl -i http://localhost/escape/html-old</b>\n <xml>curl -i http://localhost/escape/xml-old</xml>\n", | ||
"type": "json" | ||
@@ -132,3 +189,3 @@ } | ||
"title": "Example Response", | ||
"content": "Example Response\nHTTP/1.1 200 OK {\n field_text: 'text-value old',\n field_html: '<b>html-value old</b>',\n field_xml: '<xml>xml-value old</xml>'\n}\n", | ||
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value old',\n field_html: '<b>html-value old</b>',\n field_xml: '<xml>xml-value old</xml>'\n}\n", | ||
"type": "json" | ||
@@ -138,3 +195,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/escape.js" | ||
"filename": "test/fixtures/example/escape.js", | ||
"groupTitle": "Escape", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/escape" | ||
} | ||
] | ||
}, | ||
@@ -148,3 +211,3 @@ { | ||
"version": "0.7.1", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p>", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p> ", | ||
"examples": [ | ||
@@ -190,3 +253,9 @@ { | ||
}, | ||
"filename": "test/fixtures/example/example.js" | ||
"filename": "test/fixtures/example/example.js", | ||
"groupTitle": "Example", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/example/" | ||
} | ||
] | ||
}, | ||
@@ -200,3 +269,3 @@ { | ||
"version": "0.7.0", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p>", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p> ", | ||
"examples": [ | ||
@@ -242,3 +311,9 @@ { | ||
}, | ||
"filename": "test/fixtures/example/example.js" | ||
"filename": "test/fixtures/example/example.js", | ||
"groupTitle": "Example", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/example/" | ||
} | ||
] | ||
}, | ||
@@ -251,5 +326,11 @@ { | ||
"group": "Group", | ||
"groupDescription": "<p>This is a Group Description.Mulitline capable.</p>", | ||
"groupDescription": "<p>This is a Group Description. Markdown capable.</p> ", | ||
"version": "0.5.0", | ||
"filename": "test/fixtures/example/group.js" | ||
"filename": "test/fixtures/example/group.js", | ||
"groupTitle": "Group", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/group/:id" | ||
} | ||
] | ||
}, | ||
@@ -263,3 +344,3 @@ { | ||
"version": "0.1.0", | ||
"description": "<p>Title and Grouping of param, success and error</p>", | ||
"description": "<p>Title and Grouping of param, success and error</p> ", | ||
"parameter": { | ||
@@ -271,5 +352,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>No Group, automatically set Group to "Parameter"</p>" | ||
"description": "<p>No Group, automatically set Group to "Parameter"</p> " | ||
} | ||
@@ -281,5 +362,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "param2", | ||
"optional": false, | ||
"description": "<p>Group "login"</p>" | ||
"description": "<p>Group "login"</p> " | ||
}, | ||
@@ -289,6 +370,6 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Group "login" with default Value</p>" | ||
"description": "<p>Group "login" with default Value</p> " | ||
} | ||
@@ -304,5 +385,5 @@ ] | ||
"type": "String", | ||
"optional": false, | ||
"field": "success2", | ||
"optional": false, | ||
"description": "<p>Group "201"</p>" | ||
"description": "<p>Group "201"</p> " | ||
}, | ||
@@ -312,6 +393,6 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "success3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Group "201" with default Value</p>" | ||
"description": "<p>Group "201" with default Value</p> " | ||
} | ||
@@ -323,5 +404,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "success1", | ||
"optional": false, | ||
"description": "<p>No Group, automatically set "Success 200"</p>" | ||
"description": "<p>No Group, automatically set "Success 200"</p> " | ||
} | ||
@@ -337,5 +418,5 @@ ] | ||
"type": "String", | ||
"optional": false, | ||
"field": "error2", | ||
"optional": false, | ||
"description": "<p>Group "400"</p>" | ||
"description": "<p>Group "400"</p> " | ||
} | ||
@@ -347,5 +428,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "error3", | ||
"optional": false, | ||
"description": "<p>Group "401"</p>" | ||
"description": "<p>Group "401"</p> " | ||
} | ||
@@ -357,5 +438,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "error1", | ||
"optional": false, | ||
"description": "<p>No Group automatically set "Error 4xx"</p>" | ||
"description": "<p>No Group automatically set "Error 4xx"</p> " | ||
} | ||
@@ -365,3 +446,8 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/_grouping.js" | ||
"groupTitle": "Grouping", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/:id" | ||
} | ||
] | ||
}, | ||
@@ -375,3 +461,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Test for @apiHeader (same as @apiParam)</p>", | ||
"description": "<p>Test for @apiHeader (same as @apiParam)</p> ", | ||
"header": { | ||
@@ -383,5 +469,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "header1", | ||
"optional": false, | ||
"description": "<p>Parameter with type and description.</p>" | ||
"description": "<p>Parameter with type and description.</p> " | ||
}, | ||
@@ -391,4 +477,4 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "header2", | ||
"optional": false, | ||
"description": "" | ||
@@ -399,6 +485,6 @@ }, | ||
"type": "String", | ||
"optional": false, | ||
"field": "header3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Parameter with type, description and default value.</p>" | ||
"description": "<p>Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -408,5 +494,5 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "header4", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -416,10 +502,10 @@ }, | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header5", | ||
"optional": false, | ||
"description": "<p>Basic Parameter with description.</p>" | ||
"description": "<p>Basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header6", | ||
"optional": false, | ||
"description": "" | ||
@@ -429,12 +515,12 @@ }, | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header7", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Basic Parameter with description and default value.</p>" | ||
"description": "<p>Basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header8", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -444,10 +530,10 @@ }, | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header9", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description.</p>" | ||
"description": "<p>Optional basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header10", | ||
"optional": true, | ||
"description": "" | ||
@@ -457,12 +543,12 @@ }, | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header11", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description and default value.</p>" | ||
"description": "<p>Optional basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header12", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -473,5 +559,5 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "header13", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type and description.</p>" | ||
"description": "<p>Optional Parameter with type and description.</p> " | ||
}, | ||
@@ -481,4 +567,4 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "header14", | ||
"optional": true, | ||
"description": "" | ||
@@ -489,6 +575,6 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "header15", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type, description and default value.</p>" | ||
"description": "<p>Optional Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -498,5 +584,5 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "header16", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -507,3 +593,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/header.js" | ||
"filename": "test/fixtures/example/header.js", | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/header/:id" | ||
} | ||
] | ||
}, | ||
@@ -517,3 +609,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Usage of @headerExample.</p>", | ||
"description": "<p>Usage of @headerExample.</p> ", | ||
"header": { | ||
@@ -523,3 +615,3 @@ "examples": [ | ||
"title": "An example:", | ||
"content": "An example:\n curl -i http://localhost/header/example/\n", | ||
"content": " curl -i http://localhost/header/example/\n", | ||
"type": "json" | ||
@@ -529,3 +621,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/header_example.js" | ||
"filename": "test/fixtures/example/header_example.js", | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/header/example/" | ||
} | ||
] | ||
}, | ||
@@ -539,3 +637,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Usage of @headerTitle.</p>", | ||
"description": "<p>Usage of @apiHeaderTitle.</p> ", | ||
"header": { | ||
@@ -546,5 +644,5 @@ "fields": { | ||
"group": "MyHeaderGroup", | ||
"optional": false, | ||
"field": "authorization", | ||
"optional": false, | ||
"description": "<p>The authorization code.</p>" | ||
"description": "<p>The authorization code.</p> " | ||
}, | ||
@@ -554,5 +652,5 @@ { | ||
"type": "string", | ||
"optional": false, | ||
"field": "text", | ||
"optional": false, | ||
"description": "<p>Some text.</p>" | ||
"description": "<p>Some text.</p> " | ||
} | ||
@@ -562,3 +660,8 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/header_title.js" | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/header/title/" | ||
} | ||
] | ||
}, | ||
@@ -572,3 +675,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Use of multiple HeaderStructures.</p>", | ||
"description": "<p>Use of multiple HeaderStructures.</p> ", | ||
"header": { | ||
@@ -579,17 +682,17 @@ "fields": { | ||
"group": "Header", | ||
"optional": false, | ||
"field": "Header3", | ||
"optional": false, | ||
"description": "<p>This is Header 3 (local).</p>" | ||
"description": "<p>This is Header 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "Header1", | ||
"optional": false, | ||
"description": "<p>This is Header 1.</p>" | ||
"description": "<p>This is Header 1.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header2", | ||
"optional": false, | ||
"description": "<p>This is Header 2.</p>" | ||
"description": "<p>This is Header 2.</p> " | ||
} | ||
@@ -599,3 +702,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/header_structure.js" | ||
"filename": "test/fixtures/example/header_structure.js", | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/header" | ||
} | ||
] | ||
}, | ||
@@ -609,4 +718,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for CoffeeScript Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.coffee" | ||
"description": "<p>Test for CoffeeScript Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.coffee", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/coffeescript" | ||
} | ||
] | ||
}, | ||
@@ -623,7 +738,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.coffee" | ||
"filename": "test/fixtures/example/language.coffee", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/coffeescript/indented1" | ||
} | ||
] | ||
}, | ||
@@ -640,7 +761,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.coffee" | ||
"filename": "test/fixtures/example/language.coffee", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/coffeescript/indented2" | ||
} | ||
] | ||
}, | ||
@@ -654,4 +781,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for Erlang Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.erl" | ||
"description": "<p>Test for Erlang Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.erl", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/erlang" | ||
} | ||
] | ||
}, | ||
@@ -668,7 +801,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n\t Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n\t Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.erl" | ||
"filename": "test/fixtures/example/language.erl", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/erlang/indented1" | ||
} | ||
] | ||
}, | ||
@@ -685,7 +824,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.erl" | ||
"filename": "test/fixtures/example/language.erl", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/erlang/indented2" | ||
} | ||
] | ||
}, | ||
@@ -699,4 +844,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for JavaScript Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.js" | ||
"description": "<p>Test for JavaScript Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.js", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/javascript" | ||
} | ||
] | ||
}, | ||
@@ -713,7 +864,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.js" | ||
"filename": "test/fixtures/example/language.js", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/javascript/indented1" | ||
} | ||
] | ||
}, | ||
@@ -730,7 +887,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.js" | ||
"filename": "test/fixtures/example/language.js", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/javascript/indented2" | ||
} | ||
] | ||
}, | ||
@@ -744,4 +907,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for Perl Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.pm" | ||
"description": "<p>Test for Perl Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/perl" | ||
} | ||
] | ||
}, | ||
@@ -758,7 +927,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n\tLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n\tLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.pm" | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/perl/indented1" | ||
} | ||
] | ||
}, | ||
@@ -775,7 +950,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.pm" | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/perl/indented2" | ||
} | ||
] | ||
}, | ||
@@ -792,52 +973,16 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.pm" | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/python", | ||
"title": "Python", | ||
"name": "GetLanguagePython", | ||
"group": "Language", | ||
"version": "0.4.0", | ||
"description": "<p>Test for Python Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.py" | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/python/indented1", | ||
"title": "Python indented 1", | ||
"name": "GetLanguagePythonIndented1", | ||
"group": "Language", | ||
"version": "0.4.0", | ||
"examples": [ | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
"url": "https://api.github.com/v1/language/perl/podcut" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.py" | ||
] | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/python/indented2", | ||
"title": "Python indented 2", | ||
"name": "GetLanguagePythonIndented2", | ||
"group": "Language", | ||
"version": "0.4.0", | ||
"examples": [ | ||
{ | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.py" | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/ruby", | ||
@@ -848,4 +993,10 @@ "title": "Ruby", | ||
"version": "0.4.0", | ||
"description": "<p>Test for Ruby Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.rb" | ||
"description": "<p>Test for Ruby Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.rb", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/ruby" | ||
} | ||
] | ||
}, | ||
@@ -862,7 +1013,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.rb" | ||
"filename": "test/fixtures/example/language.rb", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/ruby/indented1" | ||
} | ||
] | ||
}, | ||
@@ -879,7 +1036,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.rb" | ||
"filename": "test/fixtures/example/language.rb", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/ruby/indented2" | ||
} | ||
] | ||
}, | ||
@@ -893,3 +1056,3 @@ { | ||
"version": "0.6.0", | ||
"description": "<p>Enable markdown for all description fields.</p><p>This <strong>text</strong> is in a <strong>separate</strong> p.</p><ul><li>List 1</li><li>List 2</li></ul><p>Multiline markdown text, output in one line.</p>", | ||
"description": "<p>Enable markdown for all description fields.</p> <p>This <strong>text</strong> is in a <strong>separate</strong> p.</p> <ul> <li>List 1</li> <li>List 2</li> </ul> <p>Multiline markdown text, output in one line.</p> ", | ||
"parameter": { | ||
@@ -901,5 +1064,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>This is a markdown <strong>apiParam</strong></p><p>Separate line.</p>" | ||
"description": "<p>This is a markdown <strong>apiParam</strong></p> <p>Separate line.</p> " | ||
} | ||
@@ -909,3 +1072,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/markdown.js" | ||
"filename": "test/fixtures/example/markdown.js", | ||
"groupTitle": "Markdown", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/markdown/:id" | ||
} | ||
] | ||
}, | ||
@@ -919,3 +1088,3 @@ { | ||
"version": "0.1.1", | ||
"description": "<p>Parameters and different Versions: 0.1.1</p>", | ||
"description": "<p>Parameters and different Versions: 0.1.1</p> ", | ||
"parameter": { | ||
@@ -926,12 +1095,10 @@ "fields": { | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>Parameter with type and description.</p>" | ||
"description": "<p>Parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param2", | ||
"optional": false, | ||
"description": "" | ||
@@ -941,14 +1108,12 @@ }, | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Parameter with type, description and default value.</p>" | ||
"description": "<p>Parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param4", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -958,10 +1123,10 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param5", | ||
"optional": false, | ||
"description": "<p>Basic Parameter with description.</p>" | ||
"description": "<p>Optional parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param6", | ||
"optional": false, | ||
"description": "" | ||
@@ -971,12 +1136,12 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param7", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Basic Parameter with description and default value.</p>" | ||
"description": "<p>Optional parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param8", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -986,10 +1151,12 @@ }, | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param9", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description.</p>" | ||
"description": "<p>Type, parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param10", | ||
"optional": true, | ||
"description": "" | ||
@@ -999,12 +1166,14 @@ }, | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param11", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description and default value.</p>" | ||
"description": "<p>Type, parameter and default value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param12", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1015,5 +1184,5 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param13", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type and description.</p>" | ||
"description": "<p>Type, optional parameter and description.</p> " | ||
}, | ||
@@ -1023,4 +1192,4 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "param14", | ||
"optional": true, | ||
"description": "" | ||
@@ -1031,6 +1200,14 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param15", | ||
"defaultValue": "Default Value", | ||
"description": "<p>Type, optional parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type, description and default value.</p>" | ||
"field": "param26", | ||
"defaultValue": "Default Value", | ||
"description": "" | ||
}, | ||
@@ -1040,6 +1217,108 @@ { | ||
"type": "String", | ||
"field": "param16", | ||
"size": "4,8", | ||
"optional": false, | ||
"field": "param17", | ||
"description": "<p>Type, size, parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-3", | ||
"optional": false, | ||
"field": "param18", | ||
"description": "<p>Type, size, parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"size": "4,8", | ||
"optional": false, | ||
"field": "param19", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
"description": "<p>Type, size, parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-3", | ||
"optional": false, | ||
"field": "param20", | ||
"defaultValue": "1", | ||
"description": "<p>Type, size, parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"allowedValues": [ | ||
"\"value 1\"" | ||
], | ||
"optional": false, | ||
"field": "param21", | ||
"description": "<p>Type, parameter and allowed string value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"allowedValues": [ | ||
"\"value 1\"", | ||
"\"value 2\"" | ||
], | ||
"optional": false, | ||
"field": "param22", | ||
"description": "<p>Type, parameter and allowed list of string values.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"allowedValues": [ | ||
"4711" | ||
], | ||
"optional": false, | ||
"field": "param23", | ||
"description": "<p>Type, parameter and allowed value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"allowedValues": [ | ||
"4711", | ||
"4712" | ||
], | ||
"optional": false, | ||
"field": "param24", | ||
"description": "<p>Type, parameter and allowed list of values.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"size": "1,10", | ||
"allowedValues": [ | ||
"\"value 1\"" | ||
], | ||
"optional": false, | ||
"field": "param25", | ||
"description": "<p>Type, size, parameter and allowed string value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-9999", | ||
"allowedValues": [ | ||
"4711" | ||
], | ||
"optional": false, | ||
"field": "param27", | ||
"description": "<p>Type, size, parameter and allowed value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-9999", | ||
"allowedValues": [ | ||
"4711", | ||
"4712" | ||
], | ||
"optional": false, | ||
"field": "param28", | ||
"description": "<p>Type, size, parameter and allowed list of values.</p> " | ||
} | ||
@@ -1049,3 +1328,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/param.js" | ||
"filename": "test/fixtures/example/param.js", | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/:id" | ||
} | ||
] | ||
}, | ||
@@ -1059,3 +1344,3 @@ { | ||
"version": "0.1.0", | ||
"description": "<p>Parameters and different Versions: 0.1.0</p>", | ||
"description": "<p>Parameters and different Versions: 0.1.0</p> ", | ||
"parameter": { | ||
@@ -1067,5 +1352,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param0", | ||
"optional": false, | ||
"description": "<p>This param is removed in 0.1.1.</p>" | ||
"description": "<p>This param is removed in 0.1.1.</p> " | ||
}, | ||
@@ -1075,5 +1360,5 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>This is an old text.</p>" | ||
"description": "<p>This is an old text.</p> " | ||
}, | ||
@@ -1083,4 +1368,4 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param2", | ||
"optional": false, | ||
"description": "" | ||
@@ -1091,6 +1376,6 @@ }, | ||
"type": "String", | ||
"optional": false, | ||
"field": "param3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Parameter with type, description and default value.</p>" | ||
"description": "<p>Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -1100,5 +1385,5 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param4", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1108,10 +1393,10 @@ }, | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param5", | ||
"optional": false, | ||
"description": "<p>Basic Parameter with description.</p>" | ||
"description": "<p>Basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param6", | ||
"optional": false, | ||
"description": "" | ||
@@ -1121,12 +1406,12 @@ }, | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param7", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Basic Parameter with description and default value.</p>" | ||
"description": "<p>Basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param8", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1136,10 +1421,10 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param9", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description.</p>" | ||
"description": "<p>Optional basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param10", | ||
"optional": true, | ||
"description": "" | ||
@@ -1149,12 +1434,12 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param11", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description and default value.</p>" | ||
"description": "<p>Optional basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param12", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1165,5 +1450,5 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param13", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type and description.</p>" | ||
"description": "<p>Optional Parameter with type and description.</p> " | ||
}, | ||
@@ -1173,4 +1458,4 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "param14", | ||
"optional": true, | ||
"description": "" | ||
@@ -1181,6 +1466,6 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param15", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type, description and default value.</p>" | ||
"description": "<p>Optional Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -1190,5 +1475,5 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "param16", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1199,12 +1484,25 @@ } | ||
}, | ||
"filename": "test/fixtures/example/param.js" | ||
"filename": "test/fixtures/example/param.js", | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/:id" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/structure", | ||
"title": "Multiple Structures", | ||
"name": "PostStructure", | ||
"group": "Structure", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple Structures.</p>", | ||
"type": "get", | ||
"url": "/param/example/", | ||
"title": "Param Example", | ||
"name": "GetParamExample", | ||
"group": "Param", | ||
"version": "0.8.0", | ||
"description": "<p>Usage of @apiParamExample.</p> ", | ||
"examples": [ | ||
{ | ||
"title": "A common example:", | ||
"content": " curl -i http://localhost/param/example/\n", | ||
"type": "json" | ||
} | ||
], | ||
"parameter": { | ||
@@ -1215,51 +1513,49 @@ "fields": { | ||
"group": "Parameter", | ||
"field": "field3", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Field 3 (local).</p>" | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"field": "field1", | ||
"optional": false, | ||
"description": "<p>This is Field 1.</p>" | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"field": "field2", | ||
"optional": false, | ||
"description": "<p>This is Field 2.</p>" | ||
"field": "name", | ||
"description": "<p>Fullname.</p> " | ||
} | ||
] | ||
}, | ||
"examples": [ | ||
{ | ||
"title": "A JSON example:", | ||
"content": " {\n \"name\": \"John Doe\"\n }\n", | ||
"type": "json" | ||
} | ||
] | ||
}, | ||
"filename": "test/fixtures/example/param_example.js", | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/example/" | ||
} | ||
}, | ||
"filename": "test/fixtures/example/structure.js" | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/success", | ||
"title": "Multiple Success Structures", | ||
"name": "PostSuccess", | ||
"group": "Success", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple SuccessStructures.</p>", | ||
"success": { | ||
"type": "get", | ||
"url": "/param/title/", | ||
"title": "Param Title", | ||
"name": "GetParamTitle", | ||
"group": "Param", | ||
"version": "0.8.0", | ||
"description": "<p>Usage of @apiParamTitle.</p> ", | ||
"parameter": { | ||
"fields": { | ||
"Success 200": [ | ||
"Parameters only for admin users:": [ | ||
{ | ||
"group": "Success 200", | ||
"field": "success3", | ||
"group": "ParamTitleGroupname", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Success 3 (local).</p>" | ||
"field": "newPassword", | ||
"description": "<p>New password.</p> " | ||
}, | ||
{ | ||
"group": "Success 200", | ||
"field": "success1", | ||
"group": "ParamTitleGroupname", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Success 1.</p>" | ||
}, | ||
{ | ||
"group": "Success 200", | ||
"field": "success2", | ||
"optional": false, | ||
"description": "<p>This is Success 2.</p>" | ||
"field": "userId", | ||
"description": "<p>Change password of that user.</p> " | ||
} | ||
@@ -1269,70 +1565,107 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/success_structure.js" | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/title/" | ||
} | ||
] | ||
}, | ||
{ | ||
"error": { | ||
"fields": { | ||
"Error 4xx": [ | ||
{ | ||
"group": "Error 4xx", | ||
"field": "error1Error", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
} | ||
] | ||
"type": "get", | ||
"url": "/permission/", | ||
"title": "Permission", | ||
"name": "GetPermission", | ||
"group": "Permission", | ||
"version": "0.8.0", | ||
"description": "<p>@apiPermission test.</p> ", | ||
"permission": [ | ||
{ | ||
"name": "permission_admin", | ||
"title": "Admin access.", | ||
"description": "" | ||
} | ||
}, | ||
"group": "error_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/error_structure.js" | ||
], | ||
"filename": "test/fixtures/example/permission.js", | ||
"groupTitle": "Permission", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/permission/" | ||
} | ||
] | ||
}, | ||
{ | ||
"error": { | ||
"fields": { | ||
"Error 4xx": [ | ||
{ | ||
"group": "Error 4xx", | ||
"field": "error2Error", | ||
"optional": false, | ||
"description": "<p>This is Error 2.</p>" | ||
} | ||
] | ||
"type": "get", | ||
"url": "/permission/", | ||
"title": "Permission", | ||
"name": "GetPermission", | ||
"group": "Permission", | ||
"version": "0.8.0", | ||
"description": "<p>@apiPermission test.</p> ", | ||
"permission": [ | ||
{ | ||
"name": "permission_admin", | ||
"title": "Admin access.", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "permission_user", | ||
"title": "User access.", | ||
"description": "" | ||
} | ||
}, | ||
"group": "error_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/error_structure.js" | ||
], | ||
"filename": "test/fixtures/example/permission.js", | ||
"groupTitle": "Permission", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/permission/" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/sample/request/", | ||
"title": "Sampe Request", | ||
"name": "GetSampleRequest", | ||
"group": "Sample", | ||
"version": "0.8.0", | ||
"description": "<p>Usage of many @apiHeaderTitle with different parameters.</p> ", | ||
"header": { | ||
"fields": { | ||
"Header": [ | ||
"This are the Header for Group 1:": [ | ||
{ | ||
"group": "Header", | ||
"field": "header2", | ||
"group": "HeaderGroup1", | ||
"type": "string", | ||
"optional": false, | ||
"description": "<p>This is Header 2.</p>" | ||
"field": "authorization", | ||
"description": "<p>The authorization code.</p> " | ||
}, | ||
{ | ||
"group": "HeaderGroup1", | ||
"type": "string", | ||
"optional": false, | ||
"field": "secrect", | ||
"description": "<p>Additional secret.</p> " | ||
} | ||
] | ||
} | ||
}, | ||
"group": "header_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/header_structure.js" | ||
}, | ||
{ | ||
"header": { | ||
"fields": { | ||
"Header": [ | ||
], | ||
"This are the Header for Group 2:": [ | ||
{ | ||
"group": "Header", | ||
"field": "Header1", | ||
"group": "HeaderGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"description": "<p>This is Header 1.</p>" | ||
"field": "authorization", | ||
"description": "<p>The authorization code.</p> " | ||
}, | ||
{ | ||
"group": "HeaderGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "secrect", | ||
"description": "<p>Additional secret.</p> " | ||
}, | ||
{ | ||
"group": "HeaderGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "type", | ||
"description": "<p>Content-Type.</p> " | ||
} | ||
@@ -1342,28 +1675,46 @@ ] | ||
}, | ||
"group": "header_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/header_structure.js" | ||
}, | ||
{ | ||
"parameter": { | ||
"fields": { | ||
"Parameter": [ | ||
"This are Parameter for Group 1:": [ | ||
{ | ||
"group": "Parameter", | ||
"field": "field1", | ||
"group": "ParameterGroup1", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Field 1.</p>" | ||
"field": "name", | ||
"description": "<p>Your name.</p> " | ||
} | ||
], | ||
"This are Parameter for Group 2:": [ | ||
{ | ||
"group": "ParameterGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "firstname", | ||
"description": "<p>Your firstname.</p> " | ||
}, | ||
{ | ||
"group": "ParameterGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "lastname", | ||
"description": "<p>Some lastname.</p> " | ||
} | ||
] | ||
} | ||
}, | ||
"group": "structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/structure.js" | ||
"groupTitle": "Sample", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/sample/request/" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/structure", | ||
"title": "Multiple Structures", | ||
"name": "PostStructure", | ||
"group": "Structure", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple Structures.</p> ", | ||
"parameter": { | ||
@@ -1374,5 +1725,17 @@ "fields": { | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field3", | ||
"description": "<p>This is Field 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field1", | ||
"description": "<p>This is Field 1.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field2", | ||
"optional": false, | ||
"description": "<p>This is Field 2.</p>" | ||
"description": "<p>This is Field 2.</p> " | ||
} | ||
@@ -1382,9 +1745,18 @@ ] | ||
}, | ||
"group": "structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/structure.js" | ||
"filename": "test/fixtures/example/structure.js", | ||
"groupTitle": "Structure", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/structure" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/success", | ||
"title": "Multiple Success Structures", | ||
"name": "PostSuccess", | ||
"group": "Success", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple SuccessStructures.</p> ", | ||
"success": { | ||
@@ -1395,43 +1767,17 @@ "fields": { | ||
"group": "Success 200", | ||
"field": "success1", | ||
"optional": false, | ||
"description": "<p>This is Success 1.</p>" | ||
} | ||
] | ||
} | ||
}, | ||
"group": "success_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/success_structure.js" | ||
}, | ||
{ | ||
"success": { | ||
"fields": { | ||
"Success 200": [ | ||
"field": "success3", | ||
"description": "<p>This is Success 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Success 200", | ||
"field": "success2", | ||
"optional": false, | ||
"description": "<p>This is Success 2.</p>" | ||
} | ||
] | ||
} | ||
}, | ||
"group": "success_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/success_structure.js" | ||
}, | ||
{ | ||
"error": { | ||
"fields": { | ||
"Error 4xx": [ | ||
"field": "success1", | ||
"description": "<p>This is Success 1.</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"field": "error1Error", | ||
"group": "Success 200", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
"field": "success2", | ||
"description": "<p>This is Success 2.</p> " | ||
} | ||
@@ -1441,8 +1787,10 @@ ] | ||
}, | ||
"group": "title_and_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/title_and_structure.js" | ||
"filename": "test/fixtures/example/success_structure.js", | ||
"groupTitle": "Success", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/success" | ||
} | ||
] | ||
} | ||
] }); |
[ | ||
{ | ||
"type": "get", | ||
"url": "/define", | ||
"title": "Define", | ||
"name": "GetDefine", | ||
"group": "Define", | ||
"version": "0.8.0", | ||
"description": "<p>Example of @apiDefine and @apiUse</p> ", | ||
"parameter": { | ||
"fields": { | ||
"Parameter": [ | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field3", | ||
"description": "<p>This is Field 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field1", | ||
"description": "<p>This is Field 1.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field2", | ||
"description": "<p>This is Field 2.</p> " | ||
} | ||
] | ||
} | ||
}, | ||
"filename": "test/fixtures/example/define.js", | ||
"groupTitle": "Define", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/define" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
@@ -9,3 +49,3 @@ "url": "/test/error", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple ErrorStructures.</p>", | ||
"description": "<p>Use of multiple ErrorStructures.</p> ", | ||
"error": { | ||
@@ -16,17 +56,17 @@ "fields": { | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error3Error", | ||
"optional": false, | ||
"description": "<p>This is Error 3 (local).</p>" | ||
"description": "<p>This is Error 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error1Error", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
"description": "<p>This is Error 1.</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error2Error", | ||
"optional": false, | ||
"description": "<p>This is Error 2.</p>" | ||
"description": "<p>This is Error 2.</p> " | ||
} | ||
@@ -36,3 +76,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/error_structure.js" | ||
"filename": "test/fixtures/example/error_structure.js", | ||
"groupTitle": "Error", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/error" | ||
} | ||
] | ||
}, | ||
@@ -46,3 +92,3 @@ { | ||
"version": "0.1.0", | ||
"description": "<p>Use of Title and Structures in the same block.</p>", | ||
"description": "<p>Use of Title and Structures in the same block.</p> ", | ||
"success": { | ||
@@ -53,5 +99,5 @@ "fields": { | ||
"group": "204", | ||
"optional": false, | ||
"field": "message", | ||
"optional": false, | ||
"description": "<p>Successfully deleted.</p>" | ||
"description": "<p>Successfully deleted.</p> " | ||
} | ||
@@ -66,11 +112,11 @@ ] | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error3Error", | ||
"optional": false, | ||
"description": "<p>This is Error 3 (local).</p>" | ||
"description": "<p>This is Error 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"optional": false, | ||
"field": "error1Error", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
"description": "<p>This is Error 1.</p> " | ||
} | ||
@@ -80,3 +126,8 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/title_and_structure.js" | ||
"groupTitle": "Error", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/title_and_error" | ||
} | ||
] | ||
}, | ||
@@ -90,7 +141,7 @@ { | ||
"version": "0.6.0", | ||
"description": "<p>Escape Example data.</p>", | ||
"description": "<p>Escape Example data.</p> ", | ||
"examples": [ | ||
{ | ||
"title": "Example usage:", | ||
"content": "Example usage:\n curl -i http://localhost/escape/text\n <b>curl -i http://localhost/escape/html</b>\n <xml>curl -i http://localhost/escape/xml</xml>\n", | ||
"content": " curl -i http://localhost/escape/text\n <b>curl -i http://localhost/escape/html</b>\n <xml>curl -i http://localhost/escape/xml</xml>\n", | ||
"type": "json" | ||
@@ -103,3 +154,3 @@ } | ||
"title": "Example Response", | ||
"content": "Example Response\nHTTP/1.1 200 OK {\n field_text: 'text-value',\n field_html: '<b>html-value</b>',\n field_xml: '<xml>xml-value</xml>'\n}\n", | ||
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value',\n field_html: '<b>html-value</b>',\n field_xml: '<xml>xml-value</xml>'\n}\n", | ||
"type": "json" | ||
@@ -109,3 +160,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/escape.js" | ||
"filename": "test/fixtures/example/escape.js", | ||
"groupTitle": "Escape", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/escape" | ||
} | ||
] | ||
}, | ||
@@ -119,7 +176,7 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Escape Example data - with comparison.</p>", | ||
"description": "<p>Escape Example data - with comparison.</p> ", | ||
"examples": [ | ||
{ | ||
"title": "Example usage:", | ||
"content": "Example usage:\n curl -i http://localhost/escape/text-old\n <b>curl -i http://localhost/escape/html-old</b>\n <xml>curl -i http://localhost/escape/xml-old</xml>\n", | ||
"content": " curl -i http://localhost/escape/text-old\n <b>curl -i http://localhost/escape/html-old</b>\n <xml>curl -i http://localhost/escape/xml-old</xml>\n", | ||
"type": "json" | ||
@@ -132,3 +189,3 @@ } | ||
"title": "Example Response", | ||
"content": "Example Response\nHTTP/1.1 200 OK {\n field_text: 'text-value old',\n field_html: '<b>html-value old</b>',\n field_xml: '<xml>xml-value old</xml>'\n}\n", | ||
"content": "HTTP/1.1 200 OK {\n field_text: 'text-value old',\n field_html: '<b>html-value old</b>',\n field_xml: '<xml>xml-value old</xml>'\n}\n", | ||
"type": "json" | ||
@@ -138,3 +195,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/escape.js" | ||
"filename": "test/fixtures/example/escape.js", | ||
"groupTitle": "Escape", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/escape" | ||
} | ||
] | ||
}, | ||
@@ -148,3 +211,3 @@ { | ||
"version": "0.7.1", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p>", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p> ", | ||
"examples": [ | ||
@@ -190,3 +253,9 @@ { | ||
}, | ||
"filename": "test/fixtures/example/example.js" | ||
"filename": "test/fixtures/example/example.js", | ||
"groupTitle": "Example", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/example/" | ||
} | ||
] | ||
}, | ||
@@ -200,3 +269,3 @@ { | ||
"version": "0.7.0", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p>", | ||
"description": "<p>Extended usage of @apiExample with different example types.</p> ", | ||
"examples": [ | ||
@@ -242,3 +311,9 @@ { | ||
}, | ||
"filename": "test/fixtures/example/example.js" | ||
"filename": "test/fixtures/example/example.js", | ||
"groupTitle": "Example", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/example/" | ||
} | ||
] | ||
}, | ||
@@ -251,5 +326,11 @@ { | ||
"group": "Group", | ||
"groupDescription": "<p>This is a Group Description.Mulitline capable.</p>", | ||
"groupDescription": "<p>This is a Group Description. Markdown capable.</p> ", | ||
"version": "0.5.0", | ||
"filename": "test/fixtures/example/group.js" | ||
"filename": "test/fixtures/example/group.js", | ||
"groupTitle": "Group", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/group/:id" | ||
} | ||
] | ||
}, | ||
@@ -263,3 +344,3 @@ { | ||
"version": "0.1.0", | ||
"description": "<p>Title and Grouping of param, success and error</p>", | ||
"description": "<p>Title and Grouping of param, success and error</p> ", | ||
"parameter": { | ||
@@ -271,5 +352,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>No Group, automatically set Group to "Parameter"</p>" | ||
"description": "<p>No Group, automatically set Group to "Parameter"</p> " | ||
} | ||
@@ -281,5 +362,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "param2", | ||
"optional": false, | ||
"description": "<p>Group "login"</p>" | ||
"description": "<p>Group "login"</p> " | ||
}, | ||
@@ -289,6 +370,6 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Group "login" with default Value</p>" | ||
"description": "<p>Group "login" with default Value</p> " | ||
} | ||
@@ -304,5 +385,5 @@ ] | ||
"type": "String", | ||
"optional": false, | ||
"field": "success2", | ||
"optional": false, | ||
"description": "<p>Group "201"</p>" | ||
"description": "<p>Group "201"</p> " | ||
}, | ||
@@ -312,6 +393,6 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "success3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Group "201" with default Value</p>" | ||
"description": "<p>Group "201" with default Value</p> " | ||
} | ||
@@ -323,5 +404,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "success1", | ||
"optional": false, | ||
"description": "<p>No Group, automatically set "Success 200"</p>" | ||
"description": "<p>No Group, automatically set "Success 200"</p> " | ||
} | ||
@@ -337,5 +418,5 @@ ] | ||
"type": "String", | ||
"optional": false, | ||
"field": "error2", | ||
"optional": false, | ||
"description": "<p>Group "400"</p>" | ||
"description": "<p>Group "400"</p> " | ||
} | ||
@@ -347,5 +428,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "error3", | ||
"optional": false, | ||
"description": "<p>Group "401"</p>" | ||
"description": "<p>Group "401"</p> " | ||
} | ||
@@ -357,5 +438,5 @@ ], | ||
"type": "String", | ||
"optional": false, | ||
"field": "error1", | ||
"optional": false, | ||
"description": "<p>No Group automatically set "Error 4xx"</p>" | ||
"description": "<p>No Group automatically set "Error 4xx"</p> " | ||
} | ||
@@ -365,3 +446,8 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/_grouping.js" | ||
"groupTitle": "Grouping", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/:id" | ||
} | ||
] | ||
}, | ||
@@ -375,3 +461,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Test for @apiHeader (same as @apiParam)</p>", | ||
"description": "<p>Test for @apiHeader (same as @apiParam)</p> ", | ||
"header": { | ||
@@ -383,5 +469,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "header1", | ||
"optional": false, | ||
"description": "<p>Parameter with type and description.</p>" | ||
"description": "<p>Parameter with type and description.</p> " | ||
}, | ||
@@ -391,4 +477,4 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "header2", | ||
"optional": false, | ||
"description": "" | ||
@@ -399,6 +485,6 @@ }, | ||
"type": "String", | ||
"optional": false, | ||
"field": "header3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Parameter with type, description and default value.</p>" | ||
"description": "<p>Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -408,5 +494,5 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "header4", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -416,10 +502,10 @@ }, | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header5", | ||
"optional": false, | ||
"description": "<p>Basic Parameter with description.</p>" | ||
"description": "<p>Basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header6", | ||
"optional": false, | ||
"description": "" | ||
@@ -429,12 +515,12 @@ }, | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header7", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Basic Parameter with description and default value.</p>" | ||
"description": "<p>Basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header8", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -444,10 +530,10 @@ }, | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header9", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description.</p>" | ||
"description": "<p>Optional basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header10", | ||
"optional": true, | ||
"description": "" | ||
@@ -457,12 +543,12 @@ }, | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header11", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description and default value.</p>" | ||
"description": "<p>Optional basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": true, | ||
"field": "header12", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -473,5 +559,5 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "header13", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type and description.</p>" | ||
"description": "<p>Optional Parameter with type and description.</p> " | ||
}, | ||
@@ -481,4 +567,4 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "header14", | ||
"optional": true, | ||
"description": "" | ||
@@ -489,6 +575,6 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "header15", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type, description and default value.</p>" | ||
"description": "<p>Optional Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -498,5 +584,5 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "header16", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -507,3 +593,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/header.js" | ||
"filename": "test/fixtures/example/header.js", | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/header/:id" | ||
} | ||
] | ||
}, | ||
@@ -517,3 +609,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Usage of @headerExample.</p>", | ||
"description": "<p>Usage of @headerExample.</p> ", | ||
"header": { | ||
@@ -523,3 +615,3 @@ "examples": [ | ||
"title": "An example:", | ||
"content": "An example:\n curl -i http://localhost/header/example/\n", | ||
"content": " curl -i http://localhost/header/example/\n", | ||
"type": "json" | ||
@@ -529,3 +621,9 @@ } | ||
}, | ||
"filename": "test/fixtures/example/header_example.js" | ||
"filename": "test/fixtures/example/header_example.js", | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/header/example/" | ||
} | ||
] | ||
}, | ||
@@ -539,3 +637,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Usage of @headerTitle.</p>", | ||
"description": "<p>Usage of @apiHeaderTitle.</p> ", | ||
"header": { | ||
@@ -546,5 +644,5 @@ "fields": { | ||
"group": "MyHeaderGroup", | ||
"optional": false, | ||
"field": "authorization", | ||
"optional": false, | ||
"description": "<p>The authorization code.</p>" | ||
"description": "<p>The authorization code.</p> " | ||
}, | ||
@@ -554,5 +652,5 @@ { | ||
"type": "string", | ||
"optional": false, | ||
"field": "text", | ||
"optional": false, | ||
"description": "<p>Some text.</p>" | ||
"description": "<p>Some text.</p> " | ||
} | ||
@@ -562,3 +660,8 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/header_title.js" | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/header/title/" | ||
} | ||
] | ||
}, | ||
@@ -572,3 +675,3 @@ { | ||
"version": "0.5.0", | ||
"description": "<p>Use of multiple HeaderStructures.</p>", | ||
"description": "<p>Use of multiple HeaderStructures.</p> ", | ||
"header": { | ||
@@ -579,17 +682,17 @@ "fields": { | ||
"group": "Header", | ||
"optional": false, | ||
"field": "Header3", | ||
"optional": false, | ||
"description": "<p>This is Header 3 (local).</p>" | ||
"description": "<p>This is Header 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "Header1", | ||
"optional": false, | ||
"description": "<p>This is Header 1.</p>" | ||
"description": "<p>This is Header 1.</p> " | ||
}, | ||
{ | ||
"group": "Header", | ||
"optional": false, | ||
"field": "header2", | ||
"optional": false, | ||
"description": "<p>This is Header 2.</p>" | ||
"description": "<p>This is Header 2.</p> " | ||
} | ||
@@ -599,3 +702,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/header_structure.js" | ||
"filename": "test/fixtures/example/header_structure.js", | ||
"groupTitle": "Header", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/header" | ||
} | ||
] | ||
}, | ||
@@ -609,4 +718,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for CoffeeScript Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.coffee" | ||
"description": "<p>Test for CoffeeScript Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.coffee", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/coffeescript" | ||
} | ||
] | ||
}, | ||
@@ -623,7 +738,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.coffee" | ||
"filename": "test/fixtures/example/language.coffee", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/coffeescript/indented1" | ||
} | ||
] | ||
}, | ||
@@ -640,7 +761,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.coffee" | ||
"filename": "test/fixtures/example/language.coffee", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/coffeescript/indented2" | ||
} | ||
] | ||
}, | ||
@@ -654,4 +781,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for Erlang Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.erl" | ||
"description": "<p>Test for Erlang Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.erl", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/erlang" | ||
} | ||
] | ||
}, | ||
@@ -668,7 +801,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n\t Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n\t Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.erl" | ||
"filename": "test/fixtures/example/language.erl", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/erlang/indented1" | ||
} | ||
] | ||
}, | ||
@@ -685,7 +824,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.erl" | ||
"filename": "test/fixtures/example/language.erl", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/erlang/indented2" | ||
} | ||
] | ||
}, | ||
@@ -699,4 +844,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for JavaScript Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.js" | ||
"description": "<p>Test for JavaScript Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.js", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/javascript" | ||
} | ||
] | ||
}, | ||
@@ -713,7 +864,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.js" | ||
"filename": "test/fixtures/example/language.js", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/javascript/indented1" | ||
} | ||
] | ||
}, | ||
@@ -730,7 +887,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.js" | ||
"filename": "test/fixtures/example/language.js", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/javascript/indented2" | ||
} | ||
] | ||
}, | ||
@@ -744,4 +907,10 @@ { | ||
"version": "0.4.0", | ||
"description": "<p>Test for Perl Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.pm" | ||
"description": "<p>Test for Perl Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/perl" | ||
} | ||
] | ||
}, | ||
@@ -758,7 +927,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n\tLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n\tLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.pm" | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/perl/indented1" | ||
} | ||
] | ||
}, | ||
@@ -775,7 +950,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.pm" | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/perl/indented2" | ||
} | ||
] | ||
}, | ||
@@ -792,52 +973,16 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.pm" | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/python", | ||
"title": "Python", | ||
"name": "GetLanguagePython", | ||
"group": "Language", | ||
"version": "0.4.0", | ||
"description": "<p>Test for Python Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.py" | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/python/indented1", | ||
"title": "Python indented 1", | ||
"name": "GetLanguagePythonIndented1", | ||
"group": "Language", | ||
"version": "0.4.0", | ||
"examples": [ | ||
"filename": "test/fixtures/example/language.pm", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
"url": "https://api.github.com/v1/language/perl/podcut" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.py" | ||
] | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/python/indented2", | ||
"title": "Python indented 2", | ||
"name": "GetLanguagePythonIndented2", | ||
"group": "Language", | ||
"version": "0.4.0", | ||
"examples": [ | ||
{ | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.py" | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/language/ruby", | ||
@@ -848,4 +993,10 @@ "title": "Ruby", | ||
"version": "0.4.0", | ||
"description": "<p>Test for Ruby Comment-Syntax.</p>", | ||
"filename": "test/fixtures/example/language.rb" | ||
"description": "<p>Test for Ruby Comment-Syntax.</p> ", | ||
"filename": "test/fixtures/example/language.rb", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/ruby" | ||
} | ||
] | ||
}, | ||
@@ -862,7 +1013,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.rb" | ||
"filename": "test/fixtures/example/language.rb", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/ruby/indented1" | ||
} | ||
] | ||
}, | ||
@@ -879,7 +1036,13 @@ { | ||
"title": "Test for indented comment.", | ||
"content": "Test for indented comment.\nThis is example line 2.\nThis is example line 3.\n Line 4 indented (with tab at beginning).\n Line 5 indented.\nThis is example line 6.\n", | ||
"content": "This is example line 2.\nThis is example line 3.\nLine 4 indented (with tab at beginning).\nLine 5 indented.\nThis is example line 6.\n", | ||
"type": "json" | ||
} | ||
], | ||
"filename": "test/fixtures/example/language.rb" | ||
"filename": "test/fixtures/example/language.rb", | ||
"groupTitle": "Language", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/language/ruby/indented2" | ||
} | ||
] | ||
}, | ||
@@ -893,3 +1056,3 @@ { | ||
"version": "0.6.0", | ||
"description": "<p>Enable markdown for all description fields.</p><p>This <strong>text</strong> is in a <strong>separate</strong> p.</p><ul><li>List 1</li><li>List 2</li></ul><p>Multiline markdown text, output in one line.</p>", | ||
"description": "<p>Enable markdown for all description fields.</p> <p>This <strong>text</strong> is in a <strong>separate</strong> p.</p> <ul> <li>List 1</li> <li>List 2</li> </ul> <p>Multiline markdown text, output in one line.</p> ", | ||
"parameter": { | ||
@@ -901,5 +1064,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>This is a markdown <strong>apiParam</strong></p><p>Separate line.</p>" | ||
"description": "<p>This is a markdown <strong>apiParam</strong></p> <p>Separate line.</p> " | ||
} | ||
@@ -909,3 +1072,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/markdown.js" | ||
"filename": "test/fixtures/example/markdown.js", | ||
"groupTitle": "Markdown", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/markdown/:id" | ||
} | ||
] | ||
}, | ||
@@ -919,3 +1088,3 @@ { | ||
"version": "0.1.1", | ||
"description": "<p>Parameters and different Versions: 0.1.1</p>", | ||
"description": "<p>Parameters and different Versions: 0.1.1</p> ", | ||
"parameter": { | ||
@@ -926,12 +1095,10 @@ "fields": { | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>Parameter with type and description.</p>" | ||
"description": "<p>Parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param2", | ||
"optional": false, | ||
"description": "" | ||
@@ -941,14 +1108,12 @@ }, | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Parameter with type, description and default value.</p>" | ||
"description": "<p>Parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param4", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -958,10 +1123,10 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param5", | ||
"optional": false, | ||
"description": "<p>Basic Parameter with description.</p>" | ||
"description": "<p>Optional parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param6", | ||
"optional": false, | ||
"description": "" | ||
@@ -971,12 +1136,12 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param7", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Basic Parameter with description and default value.</p>" | ||
"description": "<p>Optional parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param8", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -986,10 +1151,12 @@ }, | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param9", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description.</p>" | ||
"description": "<p>Type, parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param10", | ||
"optional": true, | ||
"description": "" | ||
@@ -999,12 +1166,14 @@ }, | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param11", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description and default value.</p>" | ||
"description": "<p>Type, parameter and default value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": false, | ||
"field": "param12", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1015,5 +1184,5 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param13", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type and description.</p>" | ||
"description": "<p>Type, optional parameter and description.</p> " | ||
}, | ||
@@ -1023,4 +1192,4 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "param14", | ||
"optional": true, | ||
"description": "" | ||
@@ -1031,6 +1200,14 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param15", | ||
"defaultValue": "Default Value", | ||
"description": "<p>Type, optional parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type, description and default value.</p>" | ||
"field": "param26", | ||
"defaultValue": "Default Value", | ||
"description": "" | ||
}, | ||
@@ -1040,6 +1217,108 @@ { | ||
"type": "String", | ||
"field": "param16", | ||
"size": "4,8", | ||
"optional": false, | ||
"field": "param17", | ||
"description": "<p>Type, size, parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-3", | ||
"optional": false, | ||
"field": "param18", | ||
"description": "<p>Type, size, parameter and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"size": "4,8", | ||
"optional": false, | ||
"field": "param19", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
"description": "<p>Type, size, parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-3", | ||
"optional": false, | ||
"field": "param20", | ||
"defaultValue": "1", | ||
"description": "<p>Type, size, parameter, default value and description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"allowedValues": [ | ||
"\"value 1\"" | ||
], | ||
"optional": false, | ||
"field": "param21", | ||
"description": "<p>Type, parameter and allowed string value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"allowedValues": [ | ||
"\"value 1\"", | ||
"\"value 2\"" | ||
], | ||
"optional": false, | ||
"field": "param22", | ||
"description": "<p>Type, parameter and allowed list of string values.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"allowedValues": [ | ||
"4711" | ||
], | ||
"optional": false, | ||
"field": "param23", | ||
"description": "<p>Type, parameter and allowed value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"allowedValues": [ | ||
"4711", | ||
"4712" | ||
], | ||
"optional": false, | ||
"field": "param24", | ||
"description": "<p>Type, parameter and allowed list of values.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "String", | ||
"size": "1,10", | ||
"allowedValues": [ | ||
"\"value 1\"" | ||
], | ||
"optional": false, | ||
"field": "param25", | ||
"description": "<p>Type, size, parameter and allowed string value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-9999", | ||
"allowedValues": [ | ||
"4711" | ||
], | ||
"optional": false, | ||
"field": "param27", | ||
"description": "<p>Type, size, parameter and allowed value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"type": "Number", | ||
"size": "1-9999", | ||
"allowedValues": [ | ||
"4711", | ||
"4712" | ||
], | ||
"optional": false, | ||
"field": "param28", | ||
"description": "<p>Type, size, parameter and allowed list of values.</p> " | ||
} | ||
@@ -1049,3 +1328,9 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/param.js" | ||
"filename": "test/fixtures/example/param.js", | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/:id" | ||
} | ||
] | ||
}, | ||
@@ -1059,3 +1344,3 @@ { | ||
"version": "0.1.0", | ||
"description": "<p>Parameters and different Versions: 0.1.0</p>", | ||
"description": "<p>Parameters and different Versions: 0.1.0</p> ", | ||
"parameter": { | ||
@@ -1067,5 +1352,5 @@ "fields": { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param0", | ||
"optional": false, | ||
"description": "<p>This param is removed in 0.1.1.</p>" | ||
"description": "<p>This param is removed in 0.1.1.</p> " | ||
}, | ||
@@ -1075,5 +1360,5 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param1", | ||
"optional": false, | ||
"description": "<p>This is an old text.</p>" | ||
"description": "<p>This is an old text.</p> " | ||
}, | ||
@@ -1083,4 +1368,4 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param2", | ||
"optional": false, | ||
"description": "" | ||
@@ -1091,6 +1376,6 @@ }, | ||
"type": "String", | ||
"optional": false, | ||
"field": "param3", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Parameter with type, description and default value.</p>" | ||
"description": "<p>Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -1100,5 +1385,5 @@ { | ||
"type": "String", | ||
"optional": false, | ||
"field": "param4", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1108,10 +1393,10 @@ }, | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param5", | ||
"optional": false, | ||
"description": "<p>Basic Parameter with description.</p>" | ||
"description": "<p>Basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param6", | ||
"optional": false, | ||
"description": "" | ||
@@ -1121,12 +1406,12 @@ }, | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param7", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Basic Parameter with description and default value.</p>" | ||
"description": "<p>Basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "param8", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1136,10 +1421,10 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param9", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description.</p>" | ||
"description": "<p>Optional basic Parameter with description.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param10", | ||
"optional": true, | ||
"description": "" | ||
@@ -1149,12 +1434,12 @@ }, | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param11", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional basic Parameter with description and default value.</p>" | ||
"description": "<p>Optional basic Parameter with description and default value.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": true, | ||
"field": "param12", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1165,5 +1450,5 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param13", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type and description.</p>" | ||
"description": "<p>Optional Parameter with type and description.</p> " | ||
}, | ||
@@ -1173,4 +1458,4 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "param14", | ||
"optional": true, | ||
"description": "" | ||
@@ -1181,6 +1466,6 @@ }, | ||
"type": "String", | ||
"optional": true, | ||
"field": "param15", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "<p>Optional Parameter with type, description and default value.</p>" | ||
"description": "<p>Optional Parameter with type, description and default value.</p> " | ||
}, | ||
@@ -1190,5 +1475,5 @@ { | ||
"type": "String", | ||
"optional": true, | ||
"field": "param16", | ||
"defaultValue": "Default Value", | ||
"optional": true, | ||
"description": "" | ||
@@ -1199,12 +1484,25 @@ } | ||
}, | ||
"filename": "test/fixtures/example/param.js" | ||
"filename": "test/fixtures/example/param.js", | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/:id" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/structure", | ||
"title": "Multiple Structures", | ||
"name": "PostStructure", | ||
"group": "Structure", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple Structures.</p>", | ||
"type": "get", | ||
"url": "/param/example/", | ||
"title": "Param Example", | ||
"name": "GetParamExample", | ||
"group": "Param", | ||
"version": "0.8.0", | ||
"description": "<p>Usage of @apiParamExample.</p> ", | ||
"examples": [ | ||
{ | ||
"title": "A common example:", | ||
"content": " curl -i http://localhost/param/example/\n", | ||
"type": "json" | ||
} | ||
], | ||
"parameter": { | ||
@@ -1215,51 +1513,49 @@ "fields": { | ||
"group": "Parameter", | ||
"field": "field3", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Field 3 (local).</p>" | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"field": "field1", | ||
"optional": false, | ||
"description": "<p>This is Field 1.</p>" | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"field": "field2", | ||
"optional": false, | ||
"description": "<p>This is Field 2.</p>" | ||
"field": "name", | ||
"description": "<p>Fullname.</p> " | ||
} | ||
] | ||
}, | ||
"examples": [ | ||
{ | ||
"title": "A JSON example:", | ||
"content": " {\n \"name\": \"John Doe\"\n }\n", | ||
"type": "json" | ||
} | ||
] | ||
}, | ||
"filename": "test/fixtures/example/param_example.js", | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/example/" | ||
} | ||
}, | ||
"filename": "test/fixtures/example/structure.js" | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/success", | ||
"title": "Multiple Success Structures", | ||
"name": "PostSuccess", | ||
"group": "Success", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple SuccessStructures.</p>", | ||
"success": { | ||
"type": "get", | ||
"url": "/param/title/", | ||
"title": "Param Title", | ||
"name": "GetParamTitle", | ||
"group": "Param", | ||
"version": "0.8.0", | ||
"description": "<p>Usage of @apiParamTitle.</p> ", | ||
"parameter": { | ||
"fields": { | ||
"Success 200": [ | ||
"Parameters only for admin users:": [ | ||
{ | ||
"group": "Success 200", | ||
"field": "success3", | ||
"group": "ParamTitleGroupname", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Success 3 (local).</p>" | ||
"field": "newPassword", | ||
"description": "<p>New password.</p> " | ||
}, | ||
{ | ||
"group": "Success 200", | ||
"field": "success1", | ||
"group": "ParamTitleGroupname", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Success 1.</p>" | ||
}, | ||
{ | ||
"group": "Success 200", | ||
"field": "success2", | ||
"optional": false, | ||
"description": "<p>This is Success 2.</p>" | ||
"field": "userId", | ||
"description": "<p>Change password of that user.</p> " | ||
} | ||
@@ -1269,70 +1565,107 @@ ] | ||
}, | ||
"filename": "test/fixtures/example/success_structure.js" | ||
"groupTitle": "Param", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/param/title/" | ||
} | ||
] | ||
}, | ||
{ | ||
"error": { | ||
"fields": { | ||
"Error 4xx": [ | ||
{ | ||
"group": "Error 4xx", | ||
"field": "error1Error", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
} | ||
] | ||
"type": "get", | ||
"url": "/permission/", | ||
"title": "Permission", | ||
"name": "GetPermission", | ||
"group": "Permission", | ||
"version": "0.8.0", | ||
"description": "<p>@apiPermission test.</p> ", | ||
"permission": [ | ||
{ | ||
"name": "permission_admin", | ||
"title": "Admin access.", | ||
"description": "" | ||
} | ||
}, | ||
"group": "error_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/error_structure.js" | ||
], | ||
"filename": "test/fixtures/example/permission.js", | ||
"groupTitle": "Permission", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/permission/" | ||
} | ||
] | ||
}, | ||
{ | ||
"error": { | ||
"fields": { | ||
"Error 4xx": [ | ||
{ | ||
"group": "Error 4xx", | ||
"field": "error2Error", | ||
"optional": false, | ||
"description": "<p>This is Error 2.</p>" | ||
} | ||
] | ||
"type": "get", | ||
"url": "/permission/", | ||
"title": "Permission", | ||
"name": "GetPermission", | ||
"group": "Permission", | ||
"version": "0.8.0", | ||
"description": "<p>@apiPermission test.</p> ", | ||
"permission": [ | ||
{ | ||
"name": "permission_admin", | ||
"title": "Admin access.", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "permission_user", | ||
"title": "User access.", | ||
"description": "" | ||
} | ||
}, | ||
"group": "error_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/error_structure.js" | ||
], | ||
"filename": "test/fixtures/example/permission.js", | ||
"groupTitle": "Permission", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/permission/" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "get", | ||
"url": "/sample/request/", | ||
"title": "Sampe Request", | ||
"name": "GetSampleRequest", | ||
"group": "Sample", | ||
"version": "0.8.0", | ||
"description": "<p>Usage of many @apiHeaderTitle with different parameters.</p> ", | ||
"header": { | ||
"fields": { | ||
"Header": [ | ||
"This are the Header for Group 1:": [ | ||
{ | ||
"group": "Header", | ||
"field": "header2", | ||
"group": "HeaderGroup1", | ||
"type": "string", | ||
"optional": false, | ||
"description": "<p>This is Header 2.</p>" | ||
"field": "authorization", | ||
"description": "<p>The authorization code.</p> " | ||
}, | ||
{ | ||
"group": "HeaderGroup1", | ||
"type": "string", | ||
"optional": false, | ||
"field": "secrect", | ||
"description": "<p>Additional secret.</p> " | ||
} | ||
] | ||
} | ||
}, | ||
"group": "header_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/header_structure.js" | ||
}, | ||
{ | ||
"header": { | ||
"fields": { | ||
"Header": [ | ||
], | ||
"This are the Header for Group 2:": [ | ||
{ | ||
"group": "Header", | ||
"field": "Header1", | ||
"group": "HeaderGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"description": "<p>This is Header 1.</p>" | ||
"field": "authorization", | ||
"description": "<p>The authorization code.</p> " | ||
}, | ||
{ | ||
"group": "HeaderGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "secrect", | ||
"description": "<p>Additional secret.</p> " | ||
}, | ||
{ | ||
"group": "HeaderGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "type", | ||
"description": "<p>Content-Type.</p> " | ||
} | ||
@@ -1342,28 +1675,46 @@ ] | ||
}, | ||
"group": "header_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/header_structure.js" | ||
}, | ||
{ | ||
"parameter": { | ||
"fields": { | ||
"Parameter": [ | ||
"This are Parameter for Group 1:": [ | ||
{ | ||
"group": "Parameter", | ||
"field": "field1", | ||
"group": "ParameterGroup1", | ||
"type": "String", | ||
"optional": false, | ||
"description": "<p>This is Field 1.</p>" | ||
"field": "name", | ||
"description": "<p>Your name.</p> " | ||
} | ||
], | ||
"This are Parameter for Group 2:": [ | ||
{ | ||
"group": "ParameterGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "firstname", | ||
"description": "<p>Your firstname.</p> " | ||
}, | ||
{ | ||
"group": "ParameterGroup2", | ||
"type": "string", | ||
"optional": false, | ||
"field": "lastname", | ||
"description": "<p>Some lastname.</p> " | ||
} | ||
] | ||
} | ||
}, | ||
"group": "structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/structure.js" | ||
"groupTitle": "Sample", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/sample/request/" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/structure", | ||
"title": "Multiple Structures", | ||
"name": "PostStructure", | ||
"group": "Structure", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple Structures.</p> ", | ||
"parameter": { | ||
@@ -1374,5 +1725,17 @@ "fields": { | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field3", | ||
"description": "<p>This is Field 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field1", | ||
"description": "<p>This is Field 1.</p> " | ||
}, | ||
{ | ||
"group": "Parameter", | ||
"optional": false, | ||
"field": "field2", | ||
"optional": false, | ||
"description": "<p>This is Field 2.</p>" | ||
"description": "<p>This is Field 2.</p> " | ||
} | ||
@@ -1382,9 +1745,18 @@ ] | ||
}, | ||
"group": "structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/structure.js" | ||
"filename": "test/fixtures/example/structure.js", | ||
"groupTitle": "Structure", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/structure" | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "post", | ||
"url": "/test/success", | ||
"title": "Multiple Success Structures", | ||
"name": "PostSuccess", | ||
"group": "Success", | ||
"version": "0.1.0", | ||
"description": "<p>Use of multiple SuccessStructures.</p> ", | ||
"success": { | ||
@@ -1395,43 +1767,17 @@ "fields": { | ||
"group": "Success 200", | ||
"field": "success1", | ||
"optional": false, | ||
"description": "<p>This is Success 1.</p>" | ||
} | ||
] | ||
} | ||
}, | ||
"group": "success_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/success_structure.js" | ||
}, | ||
{ | ||
"success": { | ||
"fields": { | ||
"Success 200": [ | ||
"field": "success3", | ||
"description": "<p>This is Success 3 (local).</p> " | ||
}, | ||
{ | ||
"group": "Success 200", | ||
"field": "success2", | ||
"optional": false, | ||
"description": "<p>This is Success 2.</p>" | ||
} | ||
] | ||
} | ||
}, | ||
"group": "success_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/success_structure.js" | ||
}, | ||
{ | ||
"error": { | ||
"fields": { | ||
"Error 4xx": [ | ||
"field": "success1", | ||
"description": "<p>This is Success 1.</p> " | ||
}, | ||
{ | ||
"group": "Error 4xx", | ||
"field": "error1Error", | ||
"group": "Success 200", | ||
"optional": false, | ||
"description": "<p>This is Error 1.</p>" | ||
"field": "success2", | ||
"description": "<p>This is Success 2.</p> " | ||
} | ||
@@ -1441,8 +1787,10 @@ ] | ||
}, | ||
"group": "title_and_structure_js", | ||
"type": "", | ||
"url": "", | ||
"version": "0.0.0", | ||
"filename": "test/fixtures/example/title_and_structure.js" | ||
"filename": "test/fixtures/example/success_structure.js", | ||
"groupTitle": "Success", | ||
"sampleRequest": [ | ||
{ | ||
"url": "https://api.github.com/v1/test/success" | ||
} | ||
] | ||
} | ||
] |
@@ -5,2 +5,4 @@ define({ | ||
"description": "RESTful web API Documentation Generator", | ||
"url": "https://api.github.com/v1", | ||
"sampleUrl": "https://api.github.com/v1", | ||
"header": { | ||
@@ -15,5 +17,6 @@ "title": "My own header title", | ||
"generator": { | ||
"version": "0.7.1", | ||
"time": "2014-09-05T14:47:08.663Z" | ||
} | ||
"version": "0.8.0", | ||
"time": "2014-11-17T17:12:45.480Z" | ||
}, | ||
"apidoc": "0.2.0" | ||
}); |
@@ -5,2 +5,4 @@ { | ||
"description": "RESTful web API Documentation Generator", | ||
"url": "https://api.github.com/v1", | ||
"sampleUrl": "https://api.github.com/v1", | ||
"header": { | ||
@@ -15,5 +17,6 @@ "title": "My own header title", | ||
"generator": { | ||
"version": "0.7.1", | ||
"time": "2014-09-05T14:47:08.663Z" | ||
} | ||
"version": "0.8.0", | ||
"time": "2014-11-17T17:12:45.480Z" | ||
}, | ||
"apidoc": "0.2.0" | ||
} |
@@ -5,2 +5,4 @@ { | ||
"description": "RESTful web API Documentation Generator", | ||
"url" : "https://api.github.com/v1", | ||
"sampleUrl": "https://api.github.com/v1", | ||
"header": { | ||
@@ -7,0 +9,0 @@ "title": "My own header title", |
@@ -6,4 +6,4 @@ /** | ||
* @apiGroupDescription This is a Group Description. | ||
* Mulitline capable. | ||
* Markdown capable. | ||
* @apiVersion 0.5.0 | ||
*/ |
@@ -6,3 +6,3 @@ /** | ||
* @apiVersion 0.5.0 | ||
* @apiDescription Usage of @headerTitle. | ||
* @apiDescription Usage of @apiHeaderTitle. | ||
* | ||
@@ -9,0 +9,0 @@ * @apiHeaderTitle (MyHeaderGroup) This are the Parameters for MyGroup: |
@@ -7,14 +7,14 @@ /** | ||
* @apiDescription Enable markdown for all description fields. | ||
* | ||
* | ||
* This **text** is in a __separate__ p. | ||
* | ||
* | ||
* * List 1 | ||
* * List 2 | ||
* | ||
* Multiline markdown text, | ||
* | ||
* Multiline markdown text, | ||
* output in one line. | ||
* | ||
* @apiParam {String} param1 This is a markdown **apiParam** | ||
* | ||
* | ||
* Separate line. | ||
*/ |
@@ -8,21 +8,36 @@ /** | ||
* | ||
* @apiParam {String} param1 Parameter with type and description. | ||
* @apiParam {String} param2 | ||
* @apiParam {String} param3="Default Value" Parameter with type, description and default value. | ||
* @apiParam {String} param4="Default Value" | ||
* @apiParam param1 Parameter and description. | ||
* @apiParam param2 | ||
* @apiParam param3="Default Value" Parameter, default value and description. | ||
* @apiParam param4="Default Value" | ||
* | ||
* @apiParam param5 Basic Parameter with description. | ||
* @apiParam param6 | ||
* @apiParam param7="Default Value" Basic Parameter with description and default value. | ||
* @apiParam param8="Default Value" | ||
* @apiParam [param5] Optional parameter and description. | ||
* @apiParam [param6] | ||
* @apiParam [param7="Default Value"] Optional parameter, default value and description. | ||
* @apiParam [param8="Default Value"] | ||
* | ||
* @apiParam [param9] Optional basic Parameter with description. | ||
* @apiParam [param10] | ||
* @apiParam [param11="Default Value"] Optional basic Parameter with description and default value. | ||
* @apiParam [param12="Default Value"] | ||
* @apiParam {String} param9 Type, parameter and description. | ||
* @apiParam {String} param10 | ||
* @apiParam {String} param11="Default Value" Type, parameter and default value. | ||
* @apiParam {String} param12="Default Value" | ||
* | ||
* @apiParam {String} [param13] Optional Parameter with type and description. | ||
* @apiParam {String} [param13] Type, optional parameter and description. | ||
* @apiParam {String} [param14] | ||
* @apiParam {String} [param15="Default Value"] Optional Parameter with type, description and default value. | ||
* @apiParam {String} [param16="Default Value"] | ||
* @apiParam {String} [param15="Default Value"] Type, optional parameter, default value and description. | ||
* @apiParam {String} [param26="Default Value"] | ||
* | ||
* @apiParam {String{4,8}} param17 Type, size, parameter and description. | ||
* @apiParam {Number{1-3}} param18 Type, size, parameter and description. | ||
* @apiParam {String{4,8}} param19="Default Value" Type, size, parameter, default value and description. | ||
* @apiParam {Number{1-3}} param20=1 Type, size, parameter, default value and description. | ||
* | ||
* @apiParam {String="value 1"} param21 Type, parameter and allowed string value. | ||
* @apiParam {String="value 1", "value 2"} param22 Type, parameter and allowed list of string values. | ||
* @apiParam {Number=4711} param23 Type, parameter and allowed value. | ||
* @apiParam {Number=4711,4712} param24 Type, parameter and allowed list of values. | ||
* | ||
* @apiParam {String{1,10}="value 1"} param25 Type, size, parameter and allowed string value. | ||
* @apiParam {String{1,10}="value 1", "value 2"} param26 Type, size, parameter and allowed list of string values. | ||
* @apiParam {Number{1-9999}=4711} param27 Type, size, parameter and allowed value. | ||
* @apiParam {Number{1-9999}=4711,4712} param28 Type, size, parameter and allowed list of values. | ||
*/ | ||
@@ -29,0 +44,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances 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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 2 instances in 1 package
828586
7
169
11042
127
+ Addedcolors@1.0.3(transitive)
+ Addedfs-extra@0.12.0(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedjsonfile@2.4.0(transitive)
+ Addedncp@0.6.0(transitive)
+ Addedsemver@4.1.1(transitive)
- Removedunderscore@~1.6.0
- Removedcolors@0.6.2(transitive)
- Removedfs-extra@0.9.1(transitive)
- Removedjsonfile@1.1.1(transitive)
- Removedncp@0.5.1(transitive)
- Removedsemver@2.3.2(transitive)
- Removedunderscore@1.6.0(transitive)
Updatedcolors@~1.0.3
Updatedfs-extra@~0.12.0
Updatedsemver@~4.1.0