From ab9d00186ce86a100879f5bad36bd853ef81a210 Mon Sep 17 00:00:00 2001 From: Michael Mathews Date: Tue, 18 Oct 2011 23:38:37 +0100 Subject: [PATCH] Added support for displaying @constant docs in the default template. --- .../jsdoc/tag/dictionary/definitions.js | 4 +-- templates/default/publish.js | 30 +++++++++++++++++-- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/rhino_modules/jsdoc/tag/dictionary/definitions.js b/rhino_modules/jsdoc/tag/dictionary/definitions.js index 5fbc86c7..6246c1ee 100644 --- a/rhino_modules/jsdoc/tag/dictionary/definitions.js +++ b/rhino_modules/jsdoc/tag/dictionary/definitions.js @@ -123,7 +123,7 @@ exports.defineTags = function(dictionary) { } }); - dictionary.defineTag('defaultvalue', { + dictionary.defineTag('default', { onTagged: function(doclet, tag) { if (tag.value) { doclet.defaultvalue = tag.value; @@ -147,7 +147,7 @@ exports.defineTags = function(dictionary) { } } }) - .synonym('default'); + .synonym('defaultvalue'); dictionary.defineTag('deprecated', { // value is optional diff --git a/templates/default/publish.js b/templates/default/publish.js index 0c2f3cb8..ee974747 100644 --- a/templates/default/publish.js +++ b/templates/default/publish.js @@ -101,13 +101,18 @@ } if (f.scope && f.scope !== 'instance' && f.scope !== 'global') { - if (f.kind == 'function' || f.kind == 'member') attribs.push(f.scope); + if (f.kind == 'function' || f.kind == 'member' || f.kind == 'constant') attribs.push(f.scope); } if (f.readonly === true) { if (f.kind == 'member') attribs.push('readonly'); } + if (f.kind === 'constant') { + attribs.push('constant'); + f.kind = 'member'; + } + f.attribs = ''+htmlsafe(attribs.length? '<'+attribs.join(', ')+'> ' : '')+''; } @@ -137,6 +142,11 @@ addAttribs(doclet) } + if (doclet.kind === 'constant') { + addSignatureType(doclet); + addAttribs(doclet) + } + if (doclet.examples) { doclet.examples = doclet.examples.map(function(example) { var caption, code; @@ -165,7 +175,7 @@ data.orderBy(['longname', 'version', 'since']); // kinds of containers - var globals = find( {kind: ['member', 'function'], memberof: {isUndefined: true}} ), + var globals = find( {kind: ['member', 'function', 'constant'], memberof: {isUndefined: true}} ), modules = find({kind: 'module'}), externals = find({kind: 'external'}), mixins = find({kind: 'mixin'}), @@ -268,6 +278,17 @@ nav = nav + ''; } +// var constantNames = find({kind: 'constants'}); +// if (constantNames.length) { +// nav = nav + '

Constants

'; +// } + var mixinNames = find({kind: 'mixin'}); if (mixinNames.length) { nav = nav + '

Mixins

'; } - var globalNames = find({kind: ['member', 'function'], 'memberof': {'isUndefined': true}}); + var globalNames = find({kind: ['member', 'function', 'constant'], 'memberof': {'isUndefined': true}}); if (globalNames.length) { nav = nav + '

Global