Comparing version 0.8.2 to 0.9.0
222
CHANGELOG.md
# apiDoc Changelog | ||
#### 0.9.0 | ||
* CLI | ||
* Allow to include an external file which can set the markdown settings. (https://github.com/apidoc/apidoc/pull/166) | ||
* Template | ||
* Add custom order in [apidoc.json](https://github.com/apidoc/apidoc/blob/master/test/fixtures/example/apidoc.json) | ||
Append apiName or apiGroup in the `order` list: | ||
``` | ||
"order": [ | ||
"MyGroupName", | ||
"MyParameterName", | ||
"MyOtherParameterName" | ||
] | ||
``` | ||
* Speed up rendering of subtemplates (https://github.com/apidoc/apidoc/issues/164) | ||
* Bugfix: Special char doesn't show in @apiGroup. (https://github.com/apidoc/apidoc/issues/163) | ||
#### 0.8.2 | ||
@@ -78,3 +98,3 @@ | ||
Bugfix: Custom parsers not working. (https://github.com/apidoc/apidoc/issues/113) | ||
* Bugfix: Custom parsers not working. (https://github.com/apidoc/apidoc/issues/113) | ||
@@ -84,27 +104,21 @@ | ||
Add type for `@apiExample {type} Title`, `@apiSuccessExample`, `@apiErrorExample`. | ||
* Add type for `@apiExample {type} Title`, `@apiSuccessExample`, `@apiErrorExample`. | ||
* Add type switch in template. | ||
* Append filetype to fields at ajax reuqest testform. | ||
* Bugfix: Same file handling with regexp under win32. (https://github.com/apidoc/apidoc/issues/109) | ||
Add type switch in template. | ||
Append filetype to fields at ajax reuqest testform. | ||
Bugfix: Same file handling with regexp under win32. (https://github.com/apidoc/apidoc/issues/109) | ||
#### 0.7.0 | ||
Add rudimentary support for direct api calls (test requests) from within the doc. | ||
* New configuration var [sampleUrl](http://apidocjs.com#configuration-settings-sample-url) for `apidoc.json`. | ||
* [@apiSampleRequest](http://apidocjs.com#param-api-sample-request) | ||
* Add rudimentary support for direct api calls (test requests) from within the doc. | ||
* New configuration var [sampleUrl](http://apidocjs.com#configuration-settings-sample-url) for `apidoc.json`. | ||
* [@apiSampleRequest](http://apidocjs.com#param-api-sample-request) | ||
* Added ability to have forward slash (/) in parameter field names. | ||
* Add parameter `--parse` for parse only the files and return the parsed data. | ||
* Allow perl comments between "=pod" and "=cut". | ||
Added ability to have forward slash (/) in parameter field names. | ||
Add parameter `--parse` for parse only the files and return the parsed data. | ||
Allow perl comments between "=pod" and "=cut". | ||
#### 0.6.5 | ||
Bugfix: Change RegExp for parameter values to handle all chars. (https://github.com/apidoc/apidoc/issues/97) | ||
* Bugfix: Change RegExp for parameter values to handle all chars. (https://github.com/apidoc/apidoc/issues/97) | ||
@@ -114,3 +128,3 @@ | ||
Bugfix: Reserved parameter names. (https://github.com/apidoc/apidoc/issues/96) | ||
* Bugfix: Reserved parameter names. (https://github.com/apidoc/apidoc/issues/96) | ||
@@ -120,3 +134,3 @@ | ||
Bugfix: Multiple added url to api path after compared to other version. (https://github.com/apidoc/apidoc/issues/87) | ||
* Bugfix: Multiple added url to api path after compared to other version. (https://github.com/apidoc/apidoc/issues/87) | ||
@@ -126,70 +140,55 @@ | ||
Bugfix: Docs do not generate without optional @api [title]. (https://github.com/apidoc/apidoc/issues/82) | ||
* Bugfix: Docs do not generate without optional @api [title]. (https://github.com/apidoc/apidoc/issues/82) | ||
* Bugfix: Escape example output in `apiExample`, `apiErrorExample`, `apiSuccessExample`. (https://github.com/apidoc/apidoc/issues/78) | ||
Bugfix: Escape example output in `apiExample`, `apiErrorExample`, `apiSuccessExample`. (https://github.com/apidoc/apidoc/issues/78) | ||
#### 0.6.1 | ||
Changing font include to work on HTTPS. | ||
* Changing font include to work on HTTPS. | ||
* Some refactors and bugfixes. | ||
Some refactors and bugfixes. | ||
#### 0.6.0 | ||
Enable markdown for all description fields. | ||
* Enable markdown for all description fields. | ||
* Add `apidoc.json` configuration file for primary configuration over `package.json`. (http://apidocjs.com/#configuration) | ||
* Add template specific configuration settings. (http://apidocjs.com/#configuration-template-settings) | ||
* Add support for Perl (Doxygen) comment-style. | ||
* Add simple CSS3 preloader. | ||
Add `apidoc.json` configuration file for primary configuration over `package.json`. (http://apidocjs.com/#configuration) | ||
Add template specific configuration settings. (http://apidocjs.com/#configuration-template-settings) | ||
Add support for Perl (Doxygen) comment-style. | ||
Add simple CSS3 preloader. | ||
#### 0.5.2 | ||
Add css for printing. | ||
* Add css for printing. | ||
* Bugfix: Template IE8 compatibility. (https://github.com/apidoc/apidoc/issues/69) | ||
Bugfix: Template IE8 compatibility. (https://github.com/apidoc/apidoc/issues/69) | ||
#### 0.5.1 | ||
Update node version to 0.10.x. | ||
* Update node version to 0.10.x. | ||
* Add optional custom browser title with `apidoc.title` in `package.json`. | ||
* Add optional url endpoint with `apidoc.url` in `package.json`. | ||
* Bugfix: Template scrollbug. (https://github.com/apidoc/apidoc/issues/64) | ||
Add optional custom browser title with `apidoc.title` in `package.json`. | ||
Add optional url endpoint with `apidoc.url` in `package.json`. | ||
Bugfix: Template scrollbug. (https://github.com/apidoc/apidoc/issues/64) | ||
#### 0.5.0 | ||
Add new Functions: | ||
* [@apiGroupDescription](http://apidocjs.com/#param-api-group-description) | ||
* [@apiHeader](http://apidocjs.com/#param-api-header) | ||
* [@apiHeaderTitle](http://apidocjs.com/#param-api-header-title) | ||
* [@apiDefineHeaderStructure](http://apidocjs.com/#param-api-define-header-structure) | ||
* [@apiHeaderStructure](http://apidocjs.com/#param-api-header-structure) | ||
* Add new Functions: | ||
* [@apiGroupDescription](http://apidocjs.com/#param-api-group-description) | ||
* [@apiHeader](http://apidocjs.com/#param-api-header) | ||
* [@apiHeaderTitle](http://apidocjs.com/#param-api-header-title) | ||
* [@apiDefineHeaderStructure](http://apidocjs.com/#param-api-define-header-structure) | ||
* [@apiHeaderStructure](http://apidocjs.com/#param-api-header-structure) | ||
Remove package.json path `apidocFilename`. | ||
* Remove package.json path `apidocFilename`. | ||
* Change package.json path `apidoc`. | ||
* Add `apidoc.header` / `apidoc.footer` (with custom navigation titles). (http://apidocjs.com/#headerfooter) | ||
* Remove template basic (easier to maintain), the default template will be re-designed in a future version too. | ||
* Update template libraries. | ||
* Add test cases. | ||
Change package.json path `apidoc`. | ||
Add `apidoc.header` / `apidoc.footer` (with custom navigation titles). (http://apidocjs.com/#headerfooter) | ||
Remove template basic (easier to maintain), the default template will be re-designed in a future version too. | ||
Update template libraries. | ||
Add test cases. | ||
#### 0.4.4 | ||
Preserve other files when copying template files to the destination output dir. | ||
* Preserve other files when copying template files to the destination output dir. | ||
@@ -199,3 +198,3 @@ | ||
Added a short-circuit check. (https://github.com/apidoc/apidoc/issues/41) | ||
* Added a short-circuit check. (https://github.com/apidoc/apidoc/issues/41) | ||
@@ -205,3 +204,3 @@ | ||
Bugfix: Fix parsing of multiline string. (https://github.com/apidoc/apidoc/issues/34) | ||
* Bugfix: Fix parsing of multiline string. (https://github.com/apidoc/apidoc/issues/34) | ||
@@ -211,3 +210,3 @@ | ||
Add support for CoffeeScript comment-style. | ||
* Add support for CoffeeScript comment-style. | ||
@@ -217,27 +216,23 @@ | ||
Add support for other comment-style. Now apiDoc supports: | ||
* Erlang | ||
* JavaScript (JavaDoc-Style: e.g. also useable in C#, Go, Dart, Java, PHP, TypeScript) | ||
* Python | ||
* Ruby | ||
* Add support for other comment-style. Now apiDoc supports: | ||
* Erlang | ||
* JavaScript (JavaDoc-Style: e.g. also useable in C#, Go, Dart, Java, PHP, TypeScript) | ||
* Python | ||
* Ruby | ||
Add some programming language test cases. | ||
* Add some programming language test cases. | ||
* Remove german code comments. | ||
* Upgrade all used node modules. | ||
Remove german code comments. | ||
Upgrade all used node modules. | ||
#### 0.3.0 | ||
Replace deprecated node-markdown with [marked](https://github.com/chjj/marked). | ||
* Replace deprecated node-markdown with [marked](https://github.com/chjj/marked). | ||
* Add cli parameter for marked `--marked-...`, watch all params with`--help`. | ||
* Upgrade all used node modules. | ||
Add cli parameter for marked `--marked-...`, watch all params with`--help`. | ||
Upgrade all used node modules. | ||
#### 0.2.8 | ||
Bugfix: executable line delimiters. (again). | ||
* Bugfix: executable line delimiters. (again). | ||
@@ -247,3 +242,3 @@ | ||
Bugfix: Allow usage of structures and titles in the same block. (https://github.com/apidoc/apidoc/issues/21) | ||
* Bugfix: Allow usage of structures and titles in the same block. (https://github.com/apidoc/apidoc/issues/21) | ||
@@ -253,3 +248,3 @@ | ||
Give some indication, in case file listing with fails. (https://github.com/apidoc/apidoc/pull/20) | ||
* Give some indication, in case file listing with fails. (https://github.com/apidoc/apidoc/pull/20) | ||
@@ -259,24 +254,21 @@ | ||
Allow multiple structure includes. | ||
* Allow multiple structure includes. | ||
* Split and extend test-files. | ||
Split and extend test-files. | ||
#### 0.2.4 | ||
Bugfix: Fix parsing for empty lines and removing stars on data that spans over multiple lines. (https://github.com/apidoc/apidoc/pull/11) | ||
* Bugfix: Fix parsing for empty lines and removing stars on data that spans over multiple lines. (https://github.com/apidoc/apidoc/pull/11) | ||
* Remove http:// link to make https compliant. (https://github.com/apidoc/apidoc/pull/10) | ||
Remove http:// link to make https compliant. (https://github.com/apidoc/apidoc/pull/10) | ||
#### 0.2.3 | ||
Extend Template with url-param "compare=1" to show the compare version on page view. | ||
* Extend Template with url-param "compare=1" to show the compare version on page view. | ||
* Bugfix: Minor fix with double structure examples. | ||
Bugfix: Minor fix with double structure examples. | ||
#### 0.2.2 | ||
Bugfix: Template not show @apiSuccessExample @apiErrorExample. | ||
* Bugfix: Template not show @apiSuccessExample @apiErrorExample. | ||
@@ -286,3 +278,3 @@ | ||
Bugfix: executable line delimiters. | ||
* Bugfix: executable line delimiters. | ||
@@ -292,26 +284,23 @@ | ||
Extend `@apiParam`, `@apiSuccess`, `@apiError` with a grouping ability. Example `@apiParam (group) varname`. | ||
* Extend `@apiParam`, `@apiSuccess`, `@apiError` with a grouping ability. Example `@apiParam (group) varname`. | ||
view [@apiParam](http://apidocjs.com/#param-api-param) | ||
view [@apiParam](http://apidocjs.com/#param-api-param) | ||
* Add new Functions: | ||
* [@apiParamTitle](http://apidocjs.com/#param-api-param-title) | ||
* [@apiSuccessTitle](http://apidocjs.com/#param-api-success-title) | ||
* [@apiErrorTitle](http://apidocjs.com/#param-api-error-title) | ||
Add new Functions: | ||
* [@apiParamTitle](http://apidocjs.com/#param-api-param-title) | ||
* [@apiSuccessTitle](http://apidocjs.com/#param-api-success-title) | ||
* [@apiErrorTitle](http://apidocjs.com/#param-api-error-title) | ||
* Minor Template-Bugfixes. | ||
Minor Template-Bugfixes. | ||
#### 0.1.11 | ||
Allow whitespace in apiName and apiGroup. | ||
* Allow whitespace in apiName and apiGroup. | ||
* Bugfix: Filter for directories. | ||
* Update Node Modules to newer versions. | ||
Bugfix: Filter for directories. | ||
Update Node Modules to newer versions. | ||
#### 0.1.10 | ||
Add `-e` exclude option for Files / Directories, example `apidoc -e node_modules/`. | ||
* Add `-e` exclude option for Files / Directories, example `apidoc -e node_modules/`. | ||
@@ -321,3 +310,3 @@ | ||
Bugfix: Check for a valid title in Template. (https://github.com/apidoc/apidoc/pull/7) | ||
* Bugfix: Check for a valid title in Template. (https://github.com/apidoc/apidoc/pull/7) | ||
@@ -327,3 +316,3 @@ | ||
Bugfix: Whitespace before comment block. (https://github.com/apidoc/apidoc/pull/2) | ||
* Bugfix: Whitespace before comment block. (https://github.com/apidoc/apidoc/pull/2) | ||
@@ -333,3 +322,3 @@ | ||
Change templates, enable navigation scroll. | ||
* Change templates, enable navigation scroll. | ||
@@ -339,10 +328,9 @@ | ||
Add [@apiIgnore](http://apidocjs.com/#param-api-ignore). | ||
* Add [@apiIgnore](http://apidocjs.com/#param-api-ignore). | ||
* Update grunt Modules. | ||
Update grunt Modules. | ||
#### 0.1.6 | ||
Bugfix: OSX executable. | ||
* Bugfix: OSX executable. | ||
@@ -352,2 +340,2 @@ | ||
Official release. | ||
* Official release. |
@@ -5,2 +5,5 @@ # apiDoc Contributors | ||
* [Buts Johan](https://github.com/butsjoh) | ||
* Allow to include an external file which can set the markdown settings. [#166] (https://github.com/apidoc/apidoc/pull/166)) | ||
* [Peter Wong](https://github.com/peterwongpp) | ||
@@ -7,0 +10,0 @@ * Hide the ul for tabs if no content [#142] (https://github.com/apidoc/apidoc/pull/142)) |
@@ -294,3 +294,3 @@ var _ = require('lodash'); | ||
if( ! options.simulate) | ||
fs.writeFileSync(options.dest + './api_data.js', 'define({ api: ' + apiData + ' });'); | ||
fs.writeFileSync(options.dest + './api_data.js', 'define({ "api": ' + apiData + ' });'); | ||
@@ -297,0 +297,0 @@ // Write api_project |
@@ -122,2 +122,3 @@ var fs = require('fs'); | ||
app.log.debug('read header file: ' + filename); | ||
packageInfo.header = { | ||
@@ -127,3 +128,2 @@ title : json.header.title, | ||
}; | ||
app.log.debug('read header file: ' + filename); | ||
} | ||
@@ -138,2 +138,3 @@ | ||
app.log.debug('read footer file: ' + filename); | ||
packageInfo.footer = { | ||
@@ -143,6 +144,9 @@ title : json.footer.title, | ||
}; | ||
app.log.debug('read footer file: ' + filename); | ||
} | ||
// Order | ||
if (json.order) | ||
packageInfo.order = json.order; | ||
return packageInfo; | ||
}; |
{ | ||
"name": "apidoc", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "RESTful web API Documentation Generator", | ||
@@ -5,0 +5,0 @@ "author": "Peter Rottmann <rottmann@inveris.de>", |
@@ -6,3 +6,18 @@ define([ | ||
], function(locale, Handlebars, DiffMatchPatch) { | ||
/** | ||
* start/stop timer for simple performance check. | ||
*/ | ||
var timer; | ||
Handlebars.registerHelper('startTimer', function(text) { | ||
timer = new Date(); | ||
return ''; | ||
}); | ||
Handlebars.registerHelper('stopTimer', function(text) { | ||
console.log(new Date() - timer); | ||
return ''; | ||
}); | ||
/** | ||
* Return localized Text. | ||
@@ -85,4 +100,8 @@ * @param string text | ||
*/ | ||
var templateCache = {}; | ||
Handlebars.registerHelper('subTemplate', function(name, sourceContext) { | ||
var template = Handlebars.compile($('#template-' + name).html()); | ||
if ( ! templateCache[name]) | ||
templateCache[name] = Handlebars.compile($('#template-' + name).html()); | ||
var template = templateCache[name]; | ||
var templateContext = $.extend({}, this, sourceContext.hash); | ||
@@ -89,0 +108,0 @@ return new Handlebars.SafeString( template(templateContext) ); |
@@ -49,12 +49,10 @@ require.config({ | ||
/** | ||
* Load google web fonts. | ||
*/ | ||
loadGoogleFontCss($); | ||
// load google web fonts | ||
loadGoogleFontCss(); | ||
var api = apiData.api; | ||
/** | ||
* Templates. | ||
*/ | ||
// | ||
// Templates | ||
// | ||
var templateHeader = Handlebars.compile( $('#template-header').html() ); | ||
@@ -69,5 +67,5 @@ var templateFooter = Handlebars.compile( $('#template-footer').html() ); | ||
/** | ||
* apiProject defaults. | ||
*/ | ||
// | ||
// apiProject defaults | ||
// | ||
if ( ! apiProject.template) | ||
@@ -85,6 +83,6 @@ apiProject.template = {}; | ||
/** | ||
* Data transform. | ||
*/ | ||
// Grouped by group | ||
// | ||
// Data transform | ||
// | ||
// grouped by group | ||
var apiByGroup = _.groupBy(api, function(entry) { | ||
@@ -94,3 +92,3 @@ return entry.group; | ||
// Grouped by group and name | ||
// grouped by group and name | ||
var apiByGroupAndName = {}; | ||
@@ -103,25 +101,29 @@ $.each(apiByGroup, function(index, entries) { | ||
/** | ||
* Sort api by group - name - title. | ||
*/ | ||
// | ||
// sort api within a group by title ASC and custom order | ||
// | ||
var newList = []; | ||
var umlauts = { 'ä': 'ae', 'ü': 'ue', 'ö': 'oe', 'ß': 'ss' }; | ||
$.each(apiByGroupAndName, function(index, groupEntries) { | ||
var umlauts = { 'ä': 'ae', 'ü': 'ue', 'ö': 'oe', 'ß': 'ss' }; // TODO: remove in version 1.0 | ||
$.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 titles = []; | ||
$.each (groupEntries, function(titleName, entries) { | ||
var title = entries[0].title; | ||
if(title !== undefined) { | ||
title.toLowerCase().replace(/[äöüß]/g, function($0) { return umlauts[$0]; }); | ||
titles[title + ' #~#' + index] = 1; | ||
titles.push(title + '#~#' + titleName); // '#~#' keep reference to titleName after sorting | ||
} | ||
}); | ||
// Sort | ||
var values = Object.keys(titles); | ||
values.sort(); | ||
// sort by name ASC | ||
titles.sort(); | ||
// Add single elements to the new list | ||
values.forEach(function(name) { | ||
var values = name.split( '#~#'); | ||
groupEntries[values[1]].forEach(function(entry) { | ||
// custom order | ||
if (apiProject.order) | ||
titles = sortByOrder(titles, apiProject.order, '#~#'); | ||
// add single elements to the new list | ||
titles.forEach(function(name) { | ||
var values = name.split('#~#'); | ||
var key = values[1]; | ||
groupEntries[key].forEach(function(entry) { | ||
newList.push(entry); | ||
@@ -134,6 +136,7 @@ }); | ||
/** | ||
* Group- and Versionlists. | ||
*/ | ||
// | ||
// Group- and Versionlists | ||
// | ||
var apiGroups = {}; | ||
var apiGroupTitles = {}; | ||
var apiVersions = {}; | ||
@@ -144,9 +147,15 @@ apiVersions[apiProject.version] = 1; | ||
apiGroups[entry.group] = 1; | ||
apiGroupTitles[entry.group] = entry.groupTitle || entry.group; | ||
apiVersions[entry.version] = 1; | ||
}); | ||
// Sort. | ||
// sort groups | ||
apiGroups = Object.keys(apiGroups); | ||
apiGroups.sort(); | ||
// custom order | ||
if (apiProject.order) | ||
apiGroups = sortByOrder(apiGroups, apiProject.order); | ||
// sort versions DESC | ||
apiVersions = Object.keys(apiVersions); | ||
@@ -156,21 +165,19 @@ apiVersions.sort(); | ||
/** | ||
* Create Navigationlist. | ||
*/ | ||
// | ||
// create Navigationlist | ||
// | ||
var nav = []; | ||
apiGroups.forEach(function(group) { | ||
// Mainmenu-Entry. | ||
// Mainmenu entry | ||
nav.push({ | ||
group: group, | ||
isHeader: true, | ||
title: group | ||
title: apiGroupTitles[group] | ||
}); | ||
// Add Submenu. | ||
// Submenu | ||
var oldName = ''; | ||
api.forEach(function(entry) { | ||
if(entry.group === group) | ||
{ | ||
if(oldName !== entry.name) | ||
{ | ||
if (entry.group === group) { | ||
if (oldName !== entry.name) { | ||
nav.push({ | ||
@@ -183,5 +190,3 @@ title: entry.title, | ||
}); | ||
} | ||
else | ||
{ | ||
} else { | ||
nav.push({ | ||
@@ -201,3 +206,3 @@ title: entry.title, | ||
// Mainmenu Header Entry. | ||
// Mainmenu Header entry | ||
if (apiProject.header) { | ||
@@ -212,3 +217,3 @@ nav.unshift({ | ||
// Mainmenu Footer Entry. | ||
// Mainmenu Footer entry | ||
if (apiProject.footer && apiProject.footer.title != null) { | ||
@@ -223,16 +228,10 @@ nav.push({ | ||
/** | ||
* Render Pagetitle. | ||
*/ | ||
// render pagetitle | ||
var title = apiProject.title ? apiProject.title : 'apiDoc: ' + apiProject.name + ' - ' + apiProject.version; | ||
$(document).attr('title', title); | ||
/** | ||
* Remove loader. | ||
*/ | ||
// remove loader | ||
$('#loader').remove(); | ||
/** | ||
* Render Sidenav. | ||
*/ | ||
// render sidenav | ||
var fields = { | ||
@@ -243,16 +242,10 @@ nav: nav | ||
/** | ||
* Render Generator. | ||
*/ | ||
// render Generator | ||
$('#generator').append( templateGenerator(apiProject) ); | ||
/** | ||
* Render Project. | ||
*/ | ||
// render Project | ||
_.extend(apiProject, { versions: apiVersions}); | ||
$('#project').append( templateProject(apiProject) ); | ||
/** | ||
* Render ApiDoc, header/footer documentation. | ||
*/ | ||
// render apiDoc, header/footer documentation | ||
if (apiProject.header) | ||
@@ -264,6 +257,7 @@ $('#header').append( templateHeader(apiProject.header) ); | ||
/** | ||
* Render Sections and Articles | ||
*/ | ||
// | ||
// Render Sections and Articles | ||
// | ||
var articleVersions = {}; | ||
var content = ''; | ||
apiGroups.forEach(function(groupEntry) { | ||
@@ -277,3 +271,3 @@ var articles = []; | ||
// Render all Articls of a group. | ||
// render all articles of a group | ||
api.forEach(function(entry) { | ||
@@ -295,5 +289,3 @@ if(groupEntry === entry.group) { | ||
}; | ||
} | ||
else | ||
{ | ||
} else { | ||
fields = { | ||
@@ -306,3 +298,3 @@ article: entry, | ||
// Add prefix URL for endpoint | ||
// add prefix URL for endpoint | ||
if (apiProject.url) | ||
@@ -316,3 +308,3 @@ fields.article.url = apiProject.url + fields.article.url; | ||
// TODO: make groupDescription compareable with older versions (not important for the moment). | ||
// TODO: make groupDescription compareable with older versions (not important for the moment) | ||
if (entry.groupDescription) | ||
@@ -330,3 +322,3 @@ description = entry.groupDescription; | ||
// Render Section with Articles. | ||
// render Section with Articles | ||
var fields = { | ||
@@ -338,4 +330,5 @@ group: groupEntry, | ||
}; | ||
$('#sections').append( templateSections(fields) ); | ||
content += templateSections(fields); | ||
}); | ||
$('#sections').append( content ); | ||
@@ -366,4 +359,4 @@ // Bootstrap Scrollspy | ||
* Check if Parameter (sub) List has a type Field. | ||
* Example: @apaSuccess varname1 No type. | ||
* @apaSuccess {String} varname2 With type. | ||
* Example: @apiSuccess varname1 No type. | ||
* @apiSuccess {String} varname2 With type. | ||
* | ||
@@ -373,8 +366,8 @@ * @param {Object} fields | ||
function _hasTypeInFields(fields) { | ||
hasField = false; | ||
var result = false; | ||
$.each(fields, function(name) { | ||
if (_.any(fields[name], function(item) { return item.type; }) ) | ||
hasField = true; | ||
result = true; | ||
}); | ||
return hasField; | ||
return result; | ||
} | ||
@@ -385,5 +378,4 @@ | ||
*/ | ||
function initDynamic() | ||
{ | ||
// bootstrap Popover | ||
function initDynamic() { | ||
// bootstrap popover | ||
$('a[data-toggle=popover]') | ||
@@ -398,3 +390,3 @@ .popover() | ||
$('#sidenav li').removeClass('is-new'); | ||
if(apiProject.template.withCompare) { | ||
if (apiProject.template.withCompare) { | ||
$('#sidenav li[data-version=\'' + version + '\']').each(function(){ | ||
@@ -410,3 +402,3 @@ var group = $(this).data('group'); | ||
// Tabs | ||
// tabs | ||
$('.nav-tabs-examples a').click(function (e) { | ||
@@ -418,3 +410,3 @@ e.preventDefault(); | ||
// Sample Request Switch | ||
// sample request switch | ||
$('.sample-request-switch').click(function (e) { | ||
@@ -426,3 +418,3 @@ var name = '.' + $(this).attr('name') + '-fields'; | ||
// Init Modules | ||
// init modules | ||
sampleRequest.initDynamic(); | ||
@@ -432,10 +424,8 @@ } | ||
/** | ||
* Pre- / Code-Format. | ||
*/ | ||
// Pre- / Code-Format | ||
prettyPrint(); | ||
/** | ||
* HTML-Template specific jQuery-Functions | ||
*/ | ||
// | ||
// HTML-Template specific jQuery-Functions | ||
// | ||
// Change Main Version | ||
@@ -448,7 +438,7 @@ $('#versions li.version a').on('click', function(e) { | ||
// Hide all | ||
// hide all | ||
$('article').addClass('hide'); | ||
$('#sidenav li:not(.nav-fixed)').addClass('hide'); | ||
// Show 1st equal or lower Version of each entry | ||
// show 1st equal or lower Version of each entry | ||
$('article[data-version]').each(function(index) { | ||
@@ -461,5 +451,5 @@ var group = $(this).data('group'); | ||
if($('article[data-group=\'' + group + '\'][data-name=\'' + name + '\']:visible').length === 0) { | ||
// Enable Article | ||
// enable Article | ||
$('article[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); | ||
// Enable Navigation | ||
// enable Navigation | ||
$('#sidenav li[data-group=\'' + group + '\'][data-name=\'' + name + '\'][data-version=\'' + version + '\']').removeClass('hide'); | ||
@@ -475,8 +465,9 @@ $('#sidenav li.nav-header[data-group=\'' + group + '\']').removeClass('hide'); | ||
// On click compare all currently selected Versions with their predecessor. | ||
// compare all article with their predecessor | ||
$('#compareAllWithPredecessor').on('click', changeAllVersionCompareTo); | ||
// On change the Version of an article. | ||
// change version of an article | ||
$('article .versions li.version a').on('click', changeVersionCompareTo); | ||
// compare url-parameter | ||
$.urlParam = function(name) { | ||
@@ -487,4 +478,4 @@ var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); | ||
if($.urlParam('compare')) { | ||
// URL Paramter ?compare=1 is set. | ||
if ($.urlParam('compare')) { | ||
// URL Paramter ?compare=1 is set | ||
$('#compareAllWithPredecessor').trigger('click'); | ||
@@ -499,3 +490,3 @@ | ||
/** | ||
* | ||
* Change version of an article to compare it to an other version. | ||
*/ | ||
@@ -524,3 +515,3 @@ function changeVersionCompareTo(e) { | ||
if (compareVersion && articleVersions[group][name][0] === selectedVersion || version === selectedVersion) { | ||
// Version des Eintrages wurde wieder auf höchste Version gesetzt (reset) | ||
// the version of the entry is set to the highest version (reset) | ||
resetArticle(group, name, version); | ||
@@ -545,3 +536,3 @@ } else { | ||
// Add unique id | ||
// add unique id | ||
// TODO: replace all group-name-version in template with id. | ||
@@ -584,10 +575,10 @@ fields.article.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; | ||
// Event on.click muss neu zugewiesen werden (sollte eigentlich mit on automatisch funktionieren... sollte) | ||
// Event on.click re-assign | ||
$content.find('.versions li.version a').on('click', changeVersionCompareTo); | ||
// Navigation markieren | ||
// select navigation | ||
$('#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 | ||
// TODO: on change main version or select the highest version re-render | ||
} | ||
@@ -599,3 +590,3 @@ | ||
/** | ||
* | ||
* Compare all currently selected Versions with their predecessor. | ||
*/ | ||
@@ -617,5 +608,4 @@ function changeAllVersionCompareTo(e) { | ||
}); | ||
initDynamic(); | ||
} // changeAllVersionCompareTo | ||
} | ||
@@ -626,3 +616,3 @@ /** | ||
function addArticleSettings(fields, entry) { | ||
// Add unique id | ||
// add unique id | ||
// TODO: replace all group-name-version in template with id. | ||
@@ -647,3 +637,3 @@ fields.id = fields.article.group + '-' + fields.article.name + '-' + fields.article.version; | ||
// Add template settings | ||
// add template settings | ||
fields.template = apiProject.template; | ||
@@ -653,3 +643,3 @@ } | ||
/** | ||
* Render an Article. | ||
* Render Article. | ||
*/ | ||
@@ -673,3 +663,3 @@ function renderArticle(group, name, version) { | ||
/** | ||
* Render the original Article and remove the current visible Article. | ||
* Render original Article and remove the current visible Article. | ||
*/ | ||
@@ -692,3 +682,6 @@ function resetArticle(group, name, version) { | ||
function loadGoogleFontCss($) { | ||
/** | ||
* Load google fonts. | ||
*/ | ||
function loadGoogleFontCss() { | ||
var host = document.location.hostname.toLowerCase(); | ||
@@ -707,2 +700,33 @@ var protocol = document.location.protocol.toLowerCase(); | ||
/** | ||
* Return ordered entries by custom order and append not defined entries to the end. | ||
* @param {String[]} elements | ||
* @param {String[]} order | ||
* @param {String} splitBy | ||
* @return {String[]} Custom ordered list. | ||
*/ | ||
function sortByOrder(elements, order, splitBy) { | ||
var results = []; | ||
order.forEach (function(name) { | ||
if (splitBy) | ||
elements.forEach (function(element) { | ||
var parts = element.split(splitBy); | ||
var key = parts[1]; // reference keep for sorting | ||
if (key == name) | ||
results.push(element); | ||
}); | ||
else | ||
elements.forEach (function(key) { | ||
if (key == name) | ||
results.push(name); | ||
}); | ||
}); | ||
// Append all other entries that ar not defined in order | ||
elements.forEach(function(element) { | ||
if (results.indexOf(element) === -1) | ||
results.push(element); | ||
}); | ||
return results; | ||
} | ||
}); |
@@ -1,2 +0,2 @@ | ||
define({ api: [ | ||
define({ "api": [ | ||
{ | ||
@@ -3,0 +3,0 @@ "type": "get", |
@@ -15,7 +15,14 @@ define({ | ||
}, | ||
"order": [ | ||
"Error", | ||
"Define", | ||
"PostTitleAndError", | ||
"NotExistingEntry", | ||
"PostError" | ||
], | ||
"generator": { | ||
"version": "0.8.0", | ||
"time": "2014-11-18T09:02:40.011Z" | ||
"version": "0.8.2", | ||
"time": "2014-11-28T14:02:36.750Z" | ||
}, | ||
"apidoc": "0.2.0" | ||
}); |
@@ -15,7 +15,14 @@ { | ||
}, | ||
"order": [ | ||
"Error", | ||
"Define", | ||
"PostTitleAndError", | ||
"NotExistingEntry", | ||
"PostError" | ||
], | ||
"generator": { | ||
"version": "0.8.0", | ||
"time": "2014-11-18T09:02:40.011Z" | ||
"version": "0.8.2", | ||
"time": "2014-11-28T14:02:36.750Z" | ||
}, | ||
"apidoc": "0.2.0" | ||
} |
@@ -14,3 +14,10 @@ { | ||
"filename": "footer.md" | ||
} | ||
}, | ||
"order": [ | ||
"Error", | ||
"Define", | ||
"PostTitleAndError", | ||
"NotExistingEntry", | ||
"PostError" | ||
] | ||
} |
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
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
836623
11221