diff --git a/CHANGELOG.md b/CHANGELOG.md index cd2af31c..d4f10272 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # apiDoc Changelog +#### 0.2.3 +Extend Template with url-param "compare=1" to show the compare version on page view. +Bugfix: Minor fix with double structure examples. + #### 0.2.2 Bugfix: Template not show @apiSuccessExample @apiErrorExample. diff --git a/lib/parser.js b/lib/parser.js index 0ab91481..6195f70b 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -157,7 +157,7 @@ Parser.prototype._parseBlockElements = function(indexApiBlocks, detectedElements "\" block number " + (blockIndex + 1) + ", only one definition per block allowed." ); } - + if(preventGlobal === true) { throw new Error("Can't set \"@" + element.sourceName + "\" in file \"" + self.filename + diff --git a/lib/plugins/worker_error_title.js b/lib/plugins/worker_error_title.js index e889abbf..99c6b708 100644 --- a/lib/plugins/worker_error_title.js +++ b/lib/plugins/worker_error_title.js @@ -29,5 +29,5 @@ function postProcess(parsedFiles, filenames, preProcessResults) */ module.exports = { preProcess: preProcess, - postProcess: postProcess, + postProcess: postProcess }; \ No newline at end of file diff --git a/lib/plugins/worker_info_title.js b/lib/plugins/worker_info_title.js index c1d89fc3..c648c808 100644 --- a/lib/plugins/worker_info_title.js +++ b/lib/plugins/worker_info_title.js @@ -29,5 +29,5 @@ function postProcess(parsedFiles, filenames, preProcessResults) */ module.exports = { preProcess: preProcess, - postProcess: postProcess, + postProcess: postProcess }; \ No newline at end of file diff --git a/lib/plugins/worker_param_title.js b/lib/plugins/worker_param_title.js index b0d39edc..657e5fe3 100644 --- a/lib/plugins/worker_param_title.js +++ b/lib/plugins/worker_param_title.js @@ -85,5 +85,5 @@ function postProcess(parsedFiles, filenames, preProcessResults, structureName, d */ module.exports = { preProcess: preProcess, - postProcess: postProcess, + postProcess: postProcess }; \ No newline at end of file diff --git a/lib/plugins/worker_success_title.js b/lib/plugins/worker_success_title.js index cc70f473..47738674 100644 --- a/lib/plugins/worker_success_title.js +++ b/lib/plugins/worker_success_title.js @@ -29,5 +29,5 @@ function postProcess(parsedFiles, filenames, preProcessResults) */ module.exports = { preProcess: preProcess, - postProcess: postProcess, + postProcess: postProcess }; \ No newline at end of file diff --git a/package.json b/package.json index 6a236a74..571136e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "apidoc", - "version": "0.2.2", + "version": "0.2.3", "description": "RESTful web API Documentation Generator", "author": "Peter Rottmann ", "license": "MIT", diff --git a/template/main.js b/template/main.js index bcb54105..d638e6ee 100644 --- a/template/main.js +++ b/template/main.js @@ -378,7 +378,24 @@ require([ // On change the Version of an article. $("article .versions li.version a").on("click", changeVersionCompareTo); - + + $.urlParam = function(name) { + var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href); + return (results && results[1]) ? results[1] : null; + }; + + if($.urlParam("compare")) + { + // URL Paramter ?compare=1 is set. + $("#compareAllWithPredecessor").trigger("click"); + + if(window.location.hash) + { + var id = window.location.hash; + $('html,body').animate({ scrollTop: parseInt($(id).offset().top) - 18 }, 0); + } + } + /** * */