diff --git a/modules/jsdoc/name.js b/modules/jsdoc/name.js index 46869867..3765a878 100644 --- a/modules/jsdoc/name.js +++ b/modules/jsdoc/name.js @@ -28,11 +28,6 @@ memberof = doclet.memberof || '', about = {}, parentDoc; - -// TODO -// if (currentModule) { -// name = name.replace(/^exports\.(?=.+$)/, currentModule + '.'); -// } name = name? (''+name).replace(/\.prototype\.?/g, '#') : ''; @@ -62,7 +57,7 @@ doclet.memberof = about.memberof; } - if (about.longname) { + if (about.longname && !doclet.longname) { doclet.longname = about.longname; } @@ -74,13 +69,11 @@ doclet.scope = puncToScope[about.scope]; } else { - if (doclet.name && doclet.memberof) { + if (doclet.name && doclet.memberof && !doclet.longname) { doclet.scope = 'static'; // default scope when none is provided doclet.longname = doclet.memberof + scopeToPunc[doclet.scope] + doclet.name; } } - - } function quoteUnsafe(name, kind) { // docspaced names may have unsafe characters which need to be quoted by us diff --git a/modules/jsdoc/src/parser.js b/modules/jsdoc/src/parser.js index 32f538bc..6300b4e5 100644 --- a/modules/jsdoc/src/parser.js +++ b/modules/jsdoc/src/parser.js @@ -153,6 +153,10 @@ if (memberof.doclet['this']) { return memberof.doclet['this']; } + // like: Foo.constructor = function(n) { /** blah */ this.name = n; } + else if (memberof.doclet.kind === 'function' && memberof.doclet.memberof) { + return memberof.doclet.memberof; + } // walk up to the closest class we can find else if (memberof.doclet.kind === 'class' || memberof.doclet.kind === 'module') { return memberof.doclet.longname||memberof.doclet.name; diff --git a/modules/jsdoc/tag/dictionary/definitions.js b/modules/jsdoc/tag/dictionary/definitions.js index e82dc8f5..581418d9 100644 --- a/modules/jsdoc/tag/dictionary/definitions.js +++ b/modules/jsdoc/tag/dictionary/definitions.js @@ -53,7 +53,7 @@ // handle special case where both @class and @constructor tags exist in same doclet if (tag.originalTitle === 'class') { if ( /@construct(s|or)\b/i.test(doclet.comment) ) { - doclet.classdesc = tag.value; // treat @class tag as a @classdesc tag instead + doclet.classdesc = tag.value; // treat the @class tag as a @classdesc tag instead return; } } @@ -193,9 +193,7 @@ dictionary.defineTag('instance', { onTagged: function(doclet, tag) { - setDocletScopeToTitle(doclet, tag); - - + setDocletScopeToTitle(doclet, tag); } }); @@ -203,6 +201,13 @@ mustHaveValue: true }); + dictionary.defineTag('license', { + mustHaveValue: true, + onTagged: function(doclet, tag) { + doclet.license = tag.value; + } + }); + dictionary.defineTag('alias', { mustHaveValue: true, onTagged: function(doclet, tag) { @@ -274,6 +279,15 @@ } }); + dictionary.defineTag('project', { + mustHaveValue: true, + onTagged: function(doclet, tag) { + setDocletKindToTitle(doclet, tag); + setDocletNameToValue(doclet, tag); + applyNamespace(doclet, tag); + } + }); + dictionary.defineTag('property', { onTagged: function(doclet, tag) { setDocletKindToTitle(doclet, tag); @@ -413,7 +427,8 @@ function applyNamespace(doclet, tag) { if (!doclet.name) return; // error? - doclet.name = app.jsdoc.name.applyNamespace(doclet.name, tag.title) + //doclet.displayname = doclet.name; + doclet.longname = app.jsdoc.name.applyNamespace(doclet.name, tag.title) } function setDocletNameToFilename(doclet, tag) { diff --git a/templates/default/publish.js b/templates/default/publish.js index f4b3a209..3e0fcde4 100644 --- a/templates/default/publish.js +++ b/templates/default/publish.js @@ -85,17 +85,16 @@ var modules = data.get( data.find({kind: 'module'}) ); modules.forEach(function(m) { m.methods = data.get( data.find({kind: 'function', memberof: m.longname}) ); - m.displayName = m.longname.replace(/^module:/, ''); m.hasMethods = (m.methods && m.methods.length > 0); - m.methods.forEach(function(f) { + m.methods.forEach(function(f) { var pnames = []; if (f.params) { f.params.forEach(function(p) { if (p.name && p.name.indexOf('.') === -1) { pnames.push(p.name); } }); } - f.synopsis = 'require("'+m.displayName+'").'+f.name+'('+pnames.join(', ')+');' + f.synopsis = 'require("'+m.name+'").'+f.name+'('+pnames.join(', ')+');' f.hasParams = (f.params && f.params.length > 0); f.hasReturns = (f.returns && f.returns.length > 0); }); diff --git a/templates/default/tmpl/container.mustache b/templates/default/tmpl/container.mustache index 7dfe1b3b..a2eae66a 100644 --- a/templates/default/tmpl/container.mustache +++ b/templates/default/tmpl/container.mustache @@ -168,7 +168,7 @@