diff --git a/templates/haruki/publish.js b/templates/haruki/publish.js index 1569fd71..2c10c5c1 100644 --- a/templates/haruki/publish.js +++ b/templates/haruki/publish.js @@ -18,6 +18,11 @@ addDocNode(thisNamespace, from, element.path, element.name); } else if (element.kind === 'method') { + //var _to = to; + if (element.scope === 'static') { + to = to.constructor; + } + if (! to.functions) { to.functions = {}; } @@ -38,6 +43,8 @@ "nullable": typeof element.param[i].nullable === 'boolean'? element.param[i].nullable : "" }); } + //to = _to; + } else if (element.kind === 'property') { if (! to.properties) { @@ -49,14 +56,32 @@ "type": element.type? (element.type.length === 1? element.type[0] : element.type) : "" }; } - else if (element.kind === 'constructor') { + else if (element.kind === 'constructor') { if (! to.classes) { to.classes = {}; } var thisClass = to.classes[element.name] = { "name" : element.name, - "description" : element.desc || "" + "description" : element.classdesc || "", + "access": element.access || "", + "constructor": { + "name" : element.name, + "description" : element.desc || "", + "parameters": [ + ] + } }; + + if (element.param) for (var i = 0, len = element.param.length; i < len; i++) { + thisClass.constructor.parameters.push({ + "name": element.param[i].name, + "type": element.param[i].type? (element.param[i].type.length === 1? element.param[i].type[0] : element.param[i].type) : "", + "description": element.param[i].description || "", + "default": element.param[i].defaultvalue || "", + "optional": typeof element.param[i].optional === 'boolean'? element.param[i].optional : "", + "nullable": typeof element.param[i].nullable === 'boolean'? element.param[i].nullable : "" + }); + } addDocNode(thisClass, from, element.path, element.name); } }); diff --git a/test/samples/jsdoc_test.js b/test/samples/jsdoc_test.js index 0d936d94..cc3ba77c 100644 --- a/test/samples/jsdoc_test.js +++ b/test/samples/jsdoc_test.js @@ -45,11 +45,12 @@ geometry.util.ShapeFactory.prototype = { * @class This is the basic Shape class. * It can be considered an abstract class, even though no such thing * really existing in JavaScript + * @param {Object} template * @throws {MemoryException} If there is no more memory * @throws GeneralShapeException rarely (if ever) * @return {geometry.Shape|geometry.Coordinate} A new shape. */ -geometry.Shape = function(){ +geometry.Shape = function(template){ /** * This is an example of a function that is not given as a property