mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
Merge branch 'inline_property_tags'
This commit is contained in:
commit
a406e1cebc
@ -51,8 +51,9 @@ exports.Doclet.prototype.postProcess = function() {
|
|||||||
this.setLongname(this.name);
|
this.setLongname(this.name);
|
||||||
}
|
}
|
||||||
if (this.memberof === '') {
|
if (this.memberof === '') {
|
||||||
delete(this.memberof);
|
delete(this.memberof);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.kind && this.meta && this.meta.code) {
|
if (!this.kind && this.meta && this.meta.code) {
|
||||||
this.addTag( 'kind', codetypeToKind(this.meta.code.type) );
|
this.addTag( 'kind', codetypeToKind(this.meta.code.type) );
|
||||||
}
|
}
|
||||||
@ -229,7 +230,7 @@ function codetypeToKind(type) {
|
|||||||
var kind = (type || '').toLowerCase();
|
var kind = (type || '').toLowerCase();
|
||||||
|
|
||||||
if (kind !== 'function') {
|
if (kind !== 'function') {
|
||||||
return 'property';
|
return 'member';
|
||||||
}
|
}
|
||||||
|
|
||||||
return kind;
|
return kind;
|
||||||
|
|||||||
@ -31,18 +31,18 @@ exports.resolve = function(doclet) {
|
|||||||
name = doclet.longname = doclet.meta.code.funcscope + '~' + name;
|
name = doclet.longname = doclet.meta.code.funcscope + '~' + name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (memberof) { // @memberof tag given
|
if (memberof || doclet.forceMemberof) { // @memberof tag given
|
||||||
memberof = memberof.replace(/\.prototype\.?/g, '#');
|
memberof = ('' || memberof).replace(/\.prototype\.?/g, '#');
|
||||||
|
|
||||||
// the name is a fullname, like @name foo.bar, @memberof foo
|
// the name is a fullname, like @name foo.bar, @memberof foo
|
||||||
if (name && name.indexOf(memberof) === 0) {
|
if (name && name.indexOf(memberof) === 0) {
|
||||||
about = exports.shorten(name);
|
about = exports.shorten(name, (doclet.forceMemberof? memberof : undefined));
|
||||||
}
|
}
|
||||||
else if (name && /([#.~])$/.test(memberof) ) { // like @memberof foo# or @memberof foo~
|
else if (name && /([#.~])$/.test(memberof) ) { // like @memberof foo# or @memberof foo~
|
||||||
about = exports.shorten(memberof + name);
|
about = exports.shorten(memberof + name, (doclet.forceMemberof? memberof : undefined));
|
||||||
}
|
}
|
||||||
else if (name && doclet.scope ) { // like @memberof foo# or @memberof foo~
|
else if (name && doclet.scope ) { // like @memberof foo# or @memberof foo~
|
||||||
about = exports.shorten(memberof + scopeToPunc[doclet.scope] + name);
|
about = exports.shorten(memberof + (scopeToPunc[doclet.scope]||'') + name, (doclet.forceMemberof? memberof : undefined));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { // no @memberof
|
else { // no @memberof
|
||||||
@ -67,7 +67,7 @@ exports.resolve = function(doclet) {
|
|||||||
}
|
}
|
||||||
else if (about.scope) {
|
else if (about.scope) {
|
||||||
if (about.memberof === '<global>') { // via @memberof <global> ?
|
if (about.memberof === '<global>') { // via @memberof <global> ?
|
||||||
delete doclet.scope;
|
doclet.scope = 'global';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
doclet.scope = puncToScope[about.scope];
|
doclet.scope = puncToScope[about.scope];
|
||||||
@ -130,9 +130,10 @@ exports.applyNamespace = function(longname, ns) {
|
|||||||
Given a longname like "a.b#c(2)", slice it up into ["a.b", "#", 'c', '2'],
|
Given a longname like "a.b#c(2)", slice it up into ["a.b", "#", 'c', '2'],
|
||||||
representing the memberof, the scope, the name, and variation.
|
representing the memberof, the scope, the name, and variation.
|
||||||
@param {string} longname
|
@param {string} longname
|
||||||
|
@param {string} forcedMemberof
|
||||||
@returns {object} Representing the properties of the given name.
|
@returns {object} Representing the properties of the given name.
|
||||||
*/
|
*/
|
||||||
exports.shorten = function(longname) {
|
exports.shorten = function(longname, forcedMemberof) {
|
||||||
// quoted strings in a longname are atomic, convert to tokens
|
// quoted strings in a longname are atomic, convert to tokens
|
||||||
var atoms = [], token;
|
var atoms = [], token;
|
||||||
|
|
||||||
@ -149,18 +150,32 @@ exports.shorten = function(longname) {
|
|||||||
|
|
||||||
return dot + token; // foo["bar"] => foo.@{1}@
|
return dot + token; // foo["bar"] => foo.@{1}@
|
||||||
});
|
});
|
||||||
|
|
||||||
longname = longname.replace( /\.prototype\.?/g, '#' );
|
|
||||||
|
|
||||||
var parts = longname?
|
|
||||||
(longname.match( /^(:?(.+)([#.~]))?(.+?)$/ ) || []).reverse()
|
|
||||||
: [''];
|
|
||||||
|
|
||||||
var name = parts[0] || '', // ensure name is always initialised to avoid error being thrown when calling replace on undefined [gh-24]
|
var name = '',
|
||||||
scope = parts[1] || '', // ., ~, or #
|
scope = '', // ., ~, or #
|
||||||
memberof = parts[2] || '',
|
memberof = '',
|
||||||
variation;
|
variation;
|
||||||
|
|
||||||
|
longname = longname.replace( /\.prototype\.?/g, '#' );
|
||||||
|
//console.log(forcedMemberof);
|
||||||
|
if (typeof forcedMemberof !== 'undefined') {
|
||||||
|
//console.log('forcedMemberof');
|
||||||
|
name = longname.substr(forcedMemberof.length);
|
||||||
|
var parts = forcedMemberof.match(/^(.*?)([#.~]?)$/);
|
||||||
|
//console.log(parts);
|
||||||
|
if (parts[1]) memberof = parts[1] || forcedMemberof;
|
||||||
|
if (parts[2]) scope = parts[2];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var parts = longname?
|
||||||
|
(longname.match( /^(:?(.+)([#.~]))?(.+?)$/ ) || []).reverse()
|
||||||
|
: [''];
|
||||||
|
|
||||||
|
name = parts[0] || ''; // ensure name is always initialised to avoid error being thrown when calling replace on undefined [gh-24]
|
||||||
|
scope = parts[1] || ''; // ., ~, or #
|
||||||
|
memberof = parts[2] || '';
|
||||||
|
}
|
||||||
|
|
||||||
// like /** @name foo.bar(2) */
|
// like /** @name foo.bar(2) */
|
||||||
if ( /(.+)\(([^)]+)\)$/.test(name) ) {
|
if ( /(.+)\(([^)]+)\)$/.test(name) ) {
|
||||||
name = RegExp.$1, variation = RegExp.$2;
|
name = RegExp.$1, variation = RegExp.$2;
|
||||||
@ -179,3 +194,45 @@ exports.shorten = function(longname) {
|
|||||||
return {longname: longname, memberof: memberof, scope: scope, name: name, variation: variation};
|
return {longname: longname, memberof: memberof, scope: scope, name: name, variation: variation};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Split a string that starts with a name and ends with a description, into its parts.
|
||||||
|
@param {string} nameDesc
|
||||||
|
@returns {object} Hash with "name" and "description" properties.
|
||||||
|
*/
|
||||||
|
exports.splitName = function(nameDesc) {
|
||||||
|
var name = '',
|
||||||
|
desc = '',
|
||||||
|
thisChar = '',
|
||||||
|
inQuote = false;
|
||||||
|
|
||||||
|
for (var i = 0, len = nameDesc.length; i < len; i++) {
|
||||||
|
thisChar = nameDesc.charAt(i);
|
||||||
|
|
||||||
|
if (thisChar === '\\') {
|
||||||
|
name += thisChar + nameDesc.charAt(++i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thisChar === '"') {
|
||||||
|
inQuote = !inQuote;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inQuote) {
|
||||||
|
name += thisChar;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inQuote) {
|
||||||
|
if ( /\s/.test(thisChar) ) {
|
||||||
|
desc = nameDesc.substr(i);
|
||||||
|
desc = desc.replace(/^[\s-\s]+/, '').trim();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
name += thisChar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { name: name, description: desc };
|
||||||
|
}
|
||||||
@ -100,7 +100,7 @@ exports.jsdocSchema = {
|
|||||||
"kind": { // what kind of symbol is this?
|
"kind": { // what kind of symbol is this?
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"maxItems": 1,
|
"maxItems": 1,
|
||||||
"enum": ["constructor", "module", "event", "namespace", "method", "property", "enum", "class", "interface", "constant", "mixin", "file", "version"]
|
"enum": ["constructor", "module", "event", "namespace", "method", "member", "enum", "class", "interface", "constant", "mixin", "file", "version"]
|
||||||
},
|
},
|
||||||
"refersto": { // the path to another doc: this doc is simply a renamed alias to that
|
"refersto": { // the path to another doc: this doc is simply a renamed alias to that
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
|||||||
@ -10,7 +10,7 @@ var currentModule = null;
|
|||||||
@param parser
|
@param parser
|
||||||
*/
|
*/
|
||||||
exports.attachTo = function(parser) {
|
exports.attachTo = function(parser) {
|
||||||
var jsdoc = {doclet: require('jsdoc/doclet')};
|
var jsdoc = {doclet: require('jsdoc/doclet'), name: require('jsdoc/name')};
|
||||||
|
|
||||||
// handles JSDoc comments that include a @name tag -- the code is ignored in such a case
|
// handles JSDoc comments that include a @name tag -- the code is ignored in such a case
|
||||||
parser.on('jsdocCommentFound', function(e) {
|
parser.on('jsdocCommentFound', function(e) {
|
||||||
@ -40,11 +40,11 @@ exports.attachTo = function(parser) {
|
|||||||
var newDoclet = new jsdoc.doclet.Doclet(docletSrc, e);
|
var newDoclet = new jsdoc.doclet.Doclet(docletSrc, e);
|
||||||
|
|
||||||
// an undocumented symbol right after a virtual comment? rhino mistakenly connected the two
|
// an undocumented symbol right after a virtual comment? rhino mistakenly connected the two
|
||||||
if (newDoclet.name) { // there was a @name in comment
|
if (newDoclet.name) { // there was a @name in comment
|
||||||
// try again, without the comment
|
// try again, without the comment
|
||||||
e.comment = '@undocumented';
|
e.comment = '@undocumented';
|
||||||
newDoclet = new jsdoc.doclet.Doclet(e.comment, e);
|
newDoclet = new jsdoc.doclet.Doclet(e.comment, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newDoclet.alias) {
|
if (newDoclet.alias) {
|
||||||
if (newDoclet.alias === '{@thisClass}') {
|
if (newDoclet.alias === '{@thisClass}') {
|
||||||
@ -117,6 +117,21 @@ exports.attachTo = function(parser) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// find name and description from each property tag text
|
||||||
|
if (newDoclet.properties) {
|
||||||
|
for (var i = 0, len = newDoclet.properties.length; i < len; i++) {
|
||||||
|
var property = newDoclet.properties[i];
|
||||||
|
|
||||||
|
var parts = jsdoc.name.splitName(property.description);
|
||||||
|
property.name = parts.name;
|
||||||
|
property.description = parts.description;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newDoclet.memberof) {
|
||||||
|
newDoclet.scope = 'global';
|
||||||
|
}
|
||||||
|
|
||||||
addDoclet.call(this, newDoclet);
|
addDoclet.call(this, newDoclet);
|
||||||
e.doclet = newDoclet;
|
e.doclet = newDoclet;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -200,6 +200,23 @@ exports.Parser.prototype.resolveThis = function(node) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Given: foo = { x:1 }, find foo from x.
|
||||||
|
*/
|
||||||
|
exports.Parser.prototype.resolvePropertyParent = function(node) {
|
||||||
|
var memberof = {};
|
||||||
|
|
||||||
|
if (node.parent) {
|
||||||
|
var parent = node.parent;
|
||||||
|
if (parent.type === Token.COLON) parent = parent.parent; // go up one more
|
||||||
|
|
||||||
|
memberof.id = 'astnode'+parent.hashCode();
|
||||||
|
memberof.doclet = this.refs[memberof.id];
|
||||||
|
|
||||||
|
if (memberof.doclet) { return memberof; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve what function a var is limited to.
|
* Resolve what function a var is limited to.
|
||||||
* @param {astnode} node
|
* @param {astnode} node
|
||||||
@ -285,6 +302,14 @@ function visitNode(node) {
|
|||||||
if (e.doclet) {
|
if (e.doclet) {
|
||||||
currentParser.refs['astnode'+e.code.node.hashCode()] = e.doclet; // allow lookup from value => doclet
|
currentParser.refs['astnode'+e.code.node.hashCode()] = e.doclet; // allow lookup from value => doclet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var parent = currentParser.resolvePropertyParent(node);
|
||||||
|
if (parent && parent.doclet.isEnum) {
|
||||||
|
if (!parent.doclet.properties) { parent.doclet.properties = []; }
|
||||||
|
// members of an enum inherit the enum's type
|
||||||
|
if (parent.doclet.type && !e.doclet.type) { e.doclet.type = parent.doclet.type; }
|
||||||
|
parent.doclet.properties.push(e.doclet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (node.type == Token.VAR || node.type == Token.LET || node.type == Token.CONST) {
|
else if (node.type == Token.VAR || node.type == Token.LET || node.type == Token.CONST) {
|
||||||
|
|
||||||
|
|||||||
@ -161,6 +161,15 @@ exports.defineTags = function(dictionary) {
|
|||||||
})
|
})
|
||||||
.synonym('desc');
|
.synonym('desc');
|
||||||
|
|
||||||
|
dictionary.defineTag('enum', {
|
||||||
|
canHaveType: true,
|
||||||
|
onTagged: function(doclet, tag) {
|
||||||
|
doclet.kind = 'member';
|
||||||
|
doclet.isEnum = true;
|
||||||
|
doclet.type = tag.value.type;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
dictionary.defineTag('event', {
|
dictionary.defineTag('event', {
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
setDocletKindToTitle(doclet, tag);
|
setDocletKindToTitle(doclet, tag);
|
||||||
@ -291,10 +300,17 @@ exports.defineTags = function(dictionary) {
|
|||||||
dictionary.defineTag('memberof', {
|
dictionary.defineTag('memberof', {
|
||||||
mustHaveValue: true,
|
mustHaveValue: true,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
|
if (tag.originalTitle === 'memberof!') {
|
||||||
|
doclet.forceMemberof = true;
|
||||||
|
if (tag.value === '<global>') {
|
||||||
|
doclet.addTag('global');
|
||||||
|
delete doclet.memberof;
|
||||||
|
}
|
||||||
|
}
|
||||||
setDocletMemberof(doclet, tag);
|
setDocletMemberof(doclet, tag);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.synonym('member');
|
.synonym('memberof!');
|
||||||
|
|
||||||
dictionary.defineTag('mixin', {
|
dictionary.defineTag('mixin', {
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
@ -351,6 +367,15 @@ exports.defineTags = function(dictionary) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
dictionary.defineTag('property', {
|
dictionary.defineTag('property', {
|
||||||
|
canHaveType: true,
|
||||||
|
onTagged: function(doclet, tag) {
|
||||||
|
if (!doclet.properties) { doclet.properties = []; }
|
||||||
|
doclet.properties.push(tag.value);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.synonym('prop');
|
||||||
|
|
||||||
|
dictionary.defineTag('member', {
|
||||||
canHaveType: true,
|
canHaveType: true,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
setDocletKindToTitle(doclet, tag);
|
setDocletKindToTitle(doclet, tag);
|
||||||
@ -360,7 +385,6 @@ exports.defineTags = function(dictionary) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.synonym('prop')
|
|
||||||
.synonym('var');
|
.synonym('var');
|
||||||
|
|
||||||
dictionary.defineTag('protected', {
|
dictionary.defineTag('protected', {
|
||||||
@ -401,7 +425,7 @@ exports.defineTags = function(dictionary) {
|
|||||||
mustHaveValue: true,
|
mustHaveValue: true,
|
||||||
canHaveType: true,
|
canHaveType: true,
|
||||||
onTagged: function(doclet, tag) {
|
onTagged: function(doclet, tag) {
|
||||||
if (!doclet.returns) { doclet.returns = []; }
|
if (!doclet.returns) { doclet.returns = []; }
|
||||||
doclet.returns.push(tag.value);
|
doclet.returns.push(tag.value);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -538,7 +562,9 @@ function setNameToFile(doclet, tag) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setDocletMemberof(doclet, tag) {
|
function setDocletMemberof(doclet, tag) {
|
||||||
doclet.setMemberof(tag.value);
|
if (tag.value && tag.value !== '<global>') {
|
||||||
|
doclet.setMemberof(tag.value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyNamespace(docletOrNs, tag) {
|
function applyNamespace(docletOrNs, tag) {
|
||||||
|
|||||||
@ -107,5 +107,5 @@ function parseTypes(type) {
|
|||||||
|
|
||||||
/** @private */
|
/** @private */
|
||||||
function trim(text) {
|
function trim(text) {
|
||||||
return text.replace(/^\s+|\s+$/g, '');
|
return text.trim();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,11 +96,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (f.scope && f.scope !== 'instance') {
|
if (f.scope && f.scope !== 'instance') {
|
||||||
if (f.kind == 'function' || f.kind == 'property') attribs.push(f.scope);
|
if (f.kind == 'function' || f.kind == 'member') attribs.push(f.scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (f.readonly === true) {
|
if (f.readonly === true) {
|
||||||
if (f.kind == 'property') attribs.push('readonly');
|
if (f.kind == 'member') attribs.push('readonly');
|
||||||
}
|
}
|
||||||
|
|
||||||
f.attribs = '<span class="type-signature">'+htmlsafe(attribs.length? '<'+attribs.join(', ')+'> ' : '')+'</span>';
|
f.attribs = '<span class="type-signature">'+htmlsafe(attribs.length? '<'+attribs.join(', ')+'> ' : '')+'</span>';
|
||||||
@ -126,7 +126,7 @@
|
|||||||
addAttribs(doclet);
|
addAttribs(doclet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doclet.kind === 'property') {
|
if (doclet.kind === 'member') {
|
||||||
addSignatureType(doclet);
|
addSignatureType(doclet);
|
||||||
addAttribs(doclet)
|
addAttribs(doclet)
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@
|
|||||||
data.orderBy(['longname', 'version', 'since']);
|
data.orderBy(['longname', 'version', 'since']);
|
||||||
|
|
||||||
// kinds of containers
|
// kinds of containers
|
||||||
var globals = find( {kind: ['property', 'function'], memberof: {isUndefined: true}} ),
|
var globals = find( {kind: ['member', 'function'], memberof: {isUndefined: true}} ),
|
||||||
modules = find({kind: 'module'}),
|
modules = find({kind: 'module'}),
|
||||||
externals = find({kind: 'external'}),
|
externals = find({kind: 'external'}),
|
||||||
mixins = find({kind: 'mixin'}),
|
mixins = find({kind: 'mixin'}),
|
||||||
@ -262,7 +262,7 @@
|
|||||||
nav = nav + '</ul>';
|
nav = nav + '</ul>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var globalNames = find({kind: ['property', 'function'], 'memberof': {'isUndefined': true}});
|
var globalNames = find({kind: ['member', 'function'], 'memberof': {'isUndefined': true}});
|
||||||
|
|
||||||
if (globalNames.length) {
|
if (globalNames.length) {
|
||||||
nav = nav + '<h3>Global</h3><ul>';
|
nav = nav + '<h3>Global</h3><ul>';
|
||||||
|
|||||||
@ -134,7 +134,7 @@ h4
|
|||||||
color: #A35A00;
|
color: #A35A00;
|
||||||
}
|
}
|
||||||
|
|
||||||
h5
|
h5, .container-overview .subsection-title
|
||||||
{
|
{
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
@ -210,16 +210,16 @@ h6
|
|||||||
border-left: 3px #ddd solid;
|
border-left: 3px #ddd solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params
|
.params, .props
|
||||||
{
|
{
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
border: 0;
|
border: 0;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params .name { color: #1C02A3; }
|
.params .name, .props .name { color: #1C02A3; }
|
||||||
|
|
||||||
.params td, .params th
|
.params td, .params th, .props td, .props th
|
||||||
{
|
{
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
@ -229,17 +229,17 @@ h6
|
|||||||
display: table-cell;
|
display: table-cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params thead tr
|
.params thead tr, .props thead tr
|
||||||
{
|
{
|
||||||
background-color: #ddd;
|
background-color: #ddd;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params .params thead tr
|
.params .params thead tr, .props .props thead tr
|
||||||
{
|
{
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.params th { border-right: 1px solid #aaa; }
|
.params th, .props th { border-right: 1px solid #aaa; }
|
||||||
.params thead .last { border-right: 1px solid #ddd; }
|
.params thead .last, .props thead .last { border-right: 1px solid #ddd; }
|
||||||
|
|||||||
@ -46,7 +46,8 @@
|
|||||||
?>
|
?>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
<div class="container-overview">
|
||||||
<?js
|
<?js
|
||||||
if (doc.kind === 'module' && doc.module) {
|
if (doc.kind === 'module' && doc.module) {
|
||||||
print(render('method.tmpl', doc.module));
|
print(render('method.tmpl', doc.module));
|
||||||
@ -68,6 +69,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?js
|
<?js
|
||||||
if (doc.augments && doc.augments.length) {
|
if (doc.augments && doc.augments.length) {
|
||||||
@ -154,18 +156,18 @@
|
|||||||
<?js } ?>
|
<?js } ?>
|
||||||
|
|
||||||
<?js
|
<?js
|
||||||
var properties = find({kind: 'property', memberof: doc.longname});
|
var members = find({kind: 'member', memberof: doc.longname});
|
||||||
if (title === 'Globals') {
|
if (title === 'Globals') {
|
||||||
properties = find({kind: 'property', memberof: {isUndefined: true}});
|
members = find({kind: 'member', memberof: {isUndefined: true}});
|
||||||
}
|
}
|
||||||
if (properties && properties.length && properties.forEach) {
|
if (members && members.length && members.forEach) {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h3 class="subsection-title">Properties</h3>
|
<h3 class="subsection-title">Members</h3>
|
||||||
|
|
||||||
<dl><?js
|
<dl><?js
|
||||||
properties.forEach(function(p) {
|
members.forEach(function(p) {
|
||||||
print(render('properties.tmpl', p));
|
print(render('members.tmpl', p));
|
||||||
});
|
});
|
||||||
?></dl>
|
?></dl>
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,17 @@
|
|||||||
<dl class="details">
|
<dl class="details">
|
||||||
|
<?js
|
||||||
|
var properties = this.properties;
|
||||||
|
if (properties && properties.length && properties.forEach) {
|
||||||
|
?>
|
||||||
|
|
||||||
|
<h5 class="subsection-title">Properties:</h5>
|
||||||
|
|
||||||
|
<dl><?js
|
||||||
|
print( render('properties.tmpl', properties) );
|
||||||
|
?></dl>
|
||||||
|
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
<?js if (this.version) {?>
|
<?js if (this.version) {?>
|
||||||
<dt class="tag-version">Version:</dt>
|
<dt class="tag-version">Version:</dt>
|
||||||
<dd class="tag-version"><ul class="dummy"><li><?js= version ?></li></ul></dd>
|
<dd class="tag-version"><ul class="dummy"><li><?js= version ?></li></ul></dd>
|
||||||
|
|||||||
24
templates/default/tmpl/members.tmpl
Normal file
24
templates/default/tmpl/members.tmpl
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
<dt id="member:<?js= longname ?>">
|
||||||
|
<h4 class="name"><?js= this.attribs + name + this.signature ?></h4>
|
||||||
|
|
||||||
|
<?js if (this.summary) { ?>
|
||||||
|
<p class="summary"><?js= summary ?></p>
|
||||||
|
<?js } ?>
|
||||||
|
</dt>
|
||||||
|
<dd>
|
||||||
|
<?js if (this.description) { ?>
|
||||||
|
<p class="description">
|
||||||
|
<?js= this.description ?>
|
||||||
|
</p>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<?js print(render('details.tmpl', this)); ?>
|
||||||
|
|
||||||
|
<?js
|
||||||
|
if (this.examples && examples.length) {
|
||||||
|
print('<h5>Example' + (examples.length > 1? 's':'') + '</h5>');
|
||||||
|
print( render('examples.tmpl', examples) );
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</dd>
|
||||||
@ -13,8 +13,6 @@
|
|||||||
</p>
|
</p>
|
||||||
<?js } ?>
|
<?js } ?>
|
||||||
|
|
||||||
<?js print(render('details.tmpl', this)); ?>
|
|
||||||
|
|
||||||
<?js
|
<?js
|
||||||
if (this['this']) {
|
if (this['this']) {
|
||||||
print('<h5>This:</h5>');
|
print('<h5>This:</h5>');
|
||||||
@ -29,6 +27,8 @@
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<?js print(render('details.tmpl', this)); ?>
|
||||||
|
|
||||||
<?js if (this.fires && fires.length) { ?>
|
<?js if (this.fires && fires.length) { ?>
|
||||||
<h5>Fires:</h5>
|
<h5>Fires:</h5>
|
||||||
<ul><?js
|
<ul><?js
|
||||||
|
|||||||
@ -1,24 +1,115 @@
|
|||||||
|
<?js
|
||||||
<dt id="property:<?js= longname ?>">
|
var props = this;
|
||||||
<h4 class="name"><?js= this.attribs + name + this.signature ?></h4>
|
|
||||||
|
|
||||||
<?js if (this.summary) { ?>
|
/* sort subprops under their parent props (like opts.classname) */
|
||||||
<p class="summary"><?js= summary ?></p>
|
var parentProp = null;
|
||||||
<?js } ?>
|
props.forEach(function(prop, i) {
|
||||||
</dt>
|
if (!prop) { return; }
|
||||||
<dd>
|
if ( parentProp && prop.name.indexOf(parentProp.name + '.') === 0 ) {
|
||||||
<?js if (this.description) { ?>
|
prop.name = prop.name.substr(parentProp.name.length+1);
|
||||||
<p class="description">
|
parentProp.subprops = parentProp.subprops || [];
|
||||||
<?js= this.description ?>
|
parentProp.subprops.push(prop);
|
||||||
</p>
|
props[i] = null;
|
||||||
<?js } ?>
|
|
||||||
|
|
||||||
<?js print(render('details.tmpl', this)); ?>
|
|
||||||
|
|
||||||
<?js
|
|
||||||
if (this.examples && examples.length) {
|
|
||||||
print('<h5>Example' + (examples.length > 1? 's':'') + '</h5>');
|
|
||||||
print( render('examples.tmpl', examples) );
|
|
||||||
}
|
}
|
||||||
?>
|
else {
|
||||||
</dd>
|
parentProp = prop;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/* determine if we need extra columns, "attributes" and "default" */
|
||||||
|
props.hasAttributes = false;
|
||||||
|
props.hasDefault = false;
|
||||||
|
props.hasName = false;
|
||||||
|
|
||||||
|
props.forEach(function(prop) {
|
||||||
|
if (!prop) { return; }
|
||||||
|
|
||||||
|
if (prop.optional || prop.nullable) {
|
||||||
|
props.hasAttributes = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prop.name) {
|
||||||
|
props.hasName = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof prop.defaultvalue !== 'undefined') {
|
||||||
|
props.hasDefault = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
?>
|
||||||
|
|
||||||
|
<table class="props">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<?js if (props.hasName) {?>
|
||||||
|
<th>Name</th>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<th>Type</th>
|
||||||
|
|
||||||
|
<?js if (props.hasAttributes) {?>
|
||||||
|
<th>Argument</th>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<?js if (props.hasDefault) {?>
|
||||||
|
<th>Default</th>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<th class="last">Description</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<?js
|
||||||
|
props.forEach(function(prop) {
|
||||||
|
if (!prop) { return; }
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<?js if (props.hasName) {?>
|
||||||
|
<td class="name"><code><?js= prop.name ?></code></td>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<td class="type">
|
||||||
|
<?js
|
||||||
|
if (prop.type && prop.type.names) {
|
||||||
|
prop.type.names.forEach(function(name, i) {
|
||||||
|
print( linkto(name, htmlsafe(name)) );
|
||||||
|
if (i < prop.type.names.length-1) { print(' | '); }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<?js if (props.hasAttributes) {?>
|
||||||
|
<td class="attributes">
|
||||||
|
<?js
|
||||||
|
if (prop.optional) {
|
||||||
|
print( '<optional><br>' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prop.nullable) {
|
||||||
|
print( '<nullable><br>' );
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<?js if (props.hasDefault) {?>
|
||||||
|
<td class="default">
|
||||||
|
<?js
|
||||||
|
if (typeof prop.defaultvalue !== 'undefined') {
|
||||||
|
print( htmlsafe(prop.defaultvalue) );
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<?js } ?>
|
||||||
|
|
||||||
|
<td class="description last"><?js= prop.description ?><?js if (prop.subprops) {
|
||||||
|
print( '<h6>Properties</h6>' + render('properties.tmpl', prop.subprops) );
|
||||||
|
}?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?js }); ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
29
test/cases/enum.js
Normal file
29
test/cases/enum.js
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
/** @constructor */
|
||||||
|
function Data() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
The current position.
|
||||||
|
@enum {number}
|
||||||
|
*/
|
||||||
|
this.point = {
|
||||||
|
/** The x coordinate of the point. */
|
||||||
|
x: 0,
|
||||||
|
|
||||||
|
/** The y coordinate of the point. */
|
||||||
|
y: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum for tri-state values.
|
||||||
|
* @enum {number}
|
||||||
|
*/
|
||||||
|
TriState = {
|
||||||
|
/** true */
|
||||||
|
TRUE: 1,
|
||||||
|
/** false */
|
||||||
|
FALSE: -1,
|
||||||
|
/** @type {boolean} */
|
||||||
|
MAYBE: true
|
||||||
|
};
|
||||||
@ -1,9 +1,9 @@
|
|||||||
/** @constructor
|
/** @constructor
|
||||||
@member mathlib
|
@memberof mathlib
|
||||||
*/
|
*/
|
||||||
function Data() {
|
function Data() {
|
||||||
|
|
||||||
/** @property */
|
/** @member */
|
||||||
this.point = {};
|
this.point = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
44
test/cases/memberoftagforced.js
Normal file
44
test/cases/memberoftagforced.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
/** @constructor
|
||||||
|
*/
|
||||||
|
function Data() {
|
||||||
|
|
||||||
|
/**
|
||||||
|
The current position.
|
||||||
|
@type {object}
|
||||||
|
@property {boolean} needsRevalidate Does this point need to be revalidated?
|
||||||
|
*/
|
||||||
|
this.point = {
|
||||||
|
/**
|
||||||
|
The x coordinate of the point.
|
||||||
|
@type {number}
|
||||||
|
@name point.x
|
||||||
|
@memberof! Data#
|
||||||
|
*/
|
||||||
|
x: 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
The y coordinate of the point.
|
||||||
|
@type {number}
|
||||||
|
@name point.y
|
||||||
|
@memberof! Data#
|
||||||
|
@see {@link Data#point.x}
|
||||||
|
*/
|
||||||
|
y: 0,
|
||||||
|
|
||||||
|
needsRevalidate: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var map = {
|
||||||
|
/**
|
||||||
|
@type {Array}
|
||||||
|
@name map.routes
|
||||||
|
@memberof! <global>
|
||||||
|
@property {Data#point} point
|
||||||
|
*/
|
||||||
|
routes: []
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The current cursor. */
|
||||||
|
var cursor = {};
|
||||||
19
test/cases/propertytag.js
Normal file
19
test/cases/propertytag.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* @namespace
|
||||||
|
* @property {Object} defaults The default values.
|
||||||
|
* @property {Number} defaults.a The a property of the defaults.
|
||||||
|
* @property {String} defaults.b The b property of the defaults.
|
||||||
|
*/
|
||||||
|
myobject = {
|
||||||
|
defaults: {
|
||||||
|
a: 1,
|
||||||
|
b: "Hit the light",
|
||||||
|
/**
|
||||||
|
* The c property of the defaults.
|
||||||
|
* @member
|
||||||
|
* @type {Boolean}
|
||||||
|
* @property {String} prop The property of c.
|
||||||
|
*/
|
||||||
|
c: true
|
||||||
|
}
|
||||||
|
};
|
||||||
@ -8,7 +8,7 @@ chat["#channel"] = {};
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@property
|
@member
|
||||||
@type {boolean}
|
@type {boolean}
|
||||||
@defaultvalue
|
@defaultvalue
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -12,6 +12,6 @@ module.exports = require('connect').createServer(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@property {number} module:blog/server.port
|
@member {number} module:blog/server.port
|
||||||
@default 8080
|
@default 8080
|
||||||
*/
|
*/
|
||||||
@ -2,8 +2,8 @@
|
|||||||
var docSet = testhelpers.getDocSetFromFile('test/cases/aliasglobal.js'),
|
var docSet = testhelpers.getDocSetFromFile('test/cases/aliasglobal.js'),
|
||||||
log = docSet.getByLongname('log')[0];
|
log = docSet.getByLongname('log')[0];
|
||||||
|
|
||||||
test('When a symbol is documented as a static member of <global> it is not static.', function() {
|
test('When a symbol is documented as a static member of <global> it\'s scope is "global" and not "static".', function() {
|
||||||
assert.equal(typeof log.scope, 'undefined');
|
assert.equal(log.scope, 'global');
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@ -13,7 +13,7 @@
|
|||||||
assert.equal(found[0][0].comment, '/** document me */', 'The first constant should get the docs.');
|
assert.equal(found[0][0].comment, '/** document me */', 'The first constant should get the docs.');
|
||||||
assert.equal(found[0][0].name, 'GREEN', 'The short name should be correct.');
|
assert.equal(found[0][0].name, 'GREEN', 'The short name should be correct.');
|
||||||
assert.equal(found[0][0].memberof, undefined, 'The memberof should be undefined.');
|
assert.equal(found[0][0].memberof, undefined, 'The memberof should be undefined.');
|
||||||
assert.equal(found[0][0].scope, undefined, 'The scope should be undefined.');
|
assert.equal(found[0][0].scope, 'global', 'The scope should be global.');
|
||||||
|
|
||||||
assert.equal(found[1].length, 1, 'The second constant should be found');
|
assert.equal(found[1].length, 1, 'The second constant should be found');
|
||||||
assert.equal(found[1][0].undocumented, true, 'The second constant should not get the docs.');
|
assert.equal(found[1][0].undocumented, true, 'The second constant should not get the docs.');
|
||||||
@ -23,7 +23,7 @@
|
|||||||
assert.equal(found[4][0].comment, '/** document me */', 'The correct var should get the docs.');
|
assert.equal(found[4][0].comment, '/** document me */', 'The correct var should get the docs.');
|
||||||
assert.equal(found[4][0].name, 'results', 'The short name should be correct.');
|
assert.equal(found[4][0].name, 'results', 'The short name should be correct.');
|
||||||
assert.equal(found[4][0].memberof, undefined, 'The memberof should be undefined.');
|
assert.equal(found[4][0].memberof, undefined, 'The memberof should be undefined.');
|
||||||
assert.equal(found[4][0].scope, undefined, 'The scope should be undefined.');
|
assert.equal(found[4][0].scope, 'global', 'The scope should be global.');
|
||||||
});
|
});
|
||||||
|
|
||||||
})();
|
})();
|
||||||
@ -117,3 +117,11 @@ test('The module:jsdoc/name.shorten function finds the variation.', function() {
|
|||||||
assert.equal(parts.name, 'fadein');
|
assert.equal(parts.name, 'fadein');
|
||||||
assert.equal(parts.longname, 'anim.fadein(2)');
|
assert.equal(parts.longname, 'anim.fadein(2)');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('The module:jsdoc/name.splitName function finds the name and description.', function() {
|
||||||
|
var startName = 'ns.Page#"last \\"sentence\\"".words~sort(2) - This is a description. ',
|
||||||
|
parts = jsdoc.name.splitName(startName);
|
||||||
|
|
||||||
|
assert.equal(parts.name, 'ns.Page#"last \\"sentence\\"".words~sort(2)');
|
||||||
|
assert.equal(parts.description, 'This is a description.');
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user