From 3fb43f45c22c4a7f1d5edb058b23a49f9f170c6c Mon Sep 17 00:00:00 2001 From: Michael Mathews Date: Sat, 5 Feb 2011 11:31:02 +0000 Subject: [PATCH] Update to default template to show property attributes. --- modules/jsdoc/package.js | 18 +++++++--- templates/default/publish.js | 7 +++- templates/default/tmpl/properties.mustache | 41 ++++++++++++++++++++-- 3 files changed, 58 insertions(+), 8 deletions(-) diff --git a/modules/jsdoc/package.js b/modules/jsdoc/package.js index eb2f7cce..776f713f 100644 --- a/modules/jsdoc/package.js +++ b/modules/jsdoc/package.js @@ -27,20 +27,28 @@ json = JSON.parse(json); - /** The name of this package. */ + /** The name of this package. + @type {string} + */ this.name = json.name; - /** The longname of this package. */ + /** The longname of this package. + @type {string} + */ this.longname = this.kind + ':' + this.name; - /** The description of this package. */ + /** The description of this package. + @type {string} + */ this.description = json.description; - /** The version of this package. */ + /** The version of this package. + @type {string} + */ this.version = json.version; /** The licenses of this package. - + @type {Array} @example "licenses": [ { diff --git a/templates/default/publish.js b/templates/default/publish.js index 89784dd4..7aebbebc 100644 --- a/templates/default/publish.js +++ b/templates/default/publish.js @@ -45,6 +45,8 @@ data.remove({undocumented: true}); + var packageInfo = (data.get( data.find({kind: 'package'}) ) || []) [0]; + // add template helpers data.forEach(function(doclet) { doclet.hasParams = doclet.params && doclet.params.length > 0; @@ -160,13 +162,16 @@ } var outdir = opts.destination; + if (packageInfo) { + outdir += '/' + packageInfo.name + '/' + packageInfo.version + '/'; + } fs.mkPath(outdir); // containers generate('Modules', modules, 'modules.html'); generate('Classes', classes, 'classes.html'); generate('Namespaces', namespaces, 'namespaces.html'); - + function generate(title, docs, filename) { var path = outdir + '/' + filename, html = Mustache.to_html( diff --git a/templates/default/tmpl/properties.mustache b/templates/default/tmpl/properties.mustache index ca2ac61a..a179ffc8 100644 --- a/templates/default/tmpl/properties.mustache +++ b/templates/default/tmpl/properties.mustache @@ -3,6 +3,43 @@

{{name}}

- {{#summary}}

{{{summary}}}

{{/summary}} +
+ {{#summary}} +
+ Summary +
+
+ {{{summary}}} +
+ {{/summary}} + + {{#type}} +
+ Type +
+
+ {{#names}} + {{#linkTo}}{{.}}{{/linkTo}}{{^last?}} | {{/last?}}{{#last?}} {{/last?}} + {{/names}} +
+ {{/type}} + + {{#nullable}} +
+ Nullable +
+
+ Yes +
+ {{/nullable}} + + {{#defaultvalue}} +
+ Default Value +
+
+ {{defaultvalue}} +
+ {{/defaultvalue}} +
-