This commit is contained in:
Jeff Williams 2014-08-11 14:13:11 -07:00
parent 7ef13bf40b
commit 277d712f3e
2 changed files with 26 additions and 25 deletions

View File

@ -146,6 +146,11 @@ function setDocletNameToFilename(doclet, tag) {
doclet.name = name; doclet.name = name;
} }
function parseTypeText(text) {
var tagType = jsdoc.tag.type.parse(text, false, true);
return tagType.typeExpression || text;
}
function parseBorrows(doclet, tag) { function parseBorrows(doclet, tag) {
var m = /^(\S+)(?:\s+as\s+(\S+))?$/.exec(tag.text); var m = /^(\S+)(?:\s+as\s+(\S+))?$/.exec(tag.text);
if (m) { if (m) {
@ -222,11 +227,7 @@ exports.defineTags = function(dictionary) {
dictionary.defineTag('augments', { dictionary.defineTag('augments', {
mustHaveValue: true, mustHaveValue: true,
// Allow augments value to be specified as a normal type, e.g. {Type} // Allow augments value to be specified as a normal type, e.g. {Type}
onTagText: function(text) { onTagText: parseTypeText,
var tagType = jsdoc.tag.type.parse(text, false, true);
return tagType.typeExpression || text;
},
onTagged: function(doclet, tag) { onTagged: function(doclet, tag) {
doclet.augment( firstWordOf(tag.value) ); doclet.augment( firstWordOf(tag.value) );
} }
@ -268,26 +269,6 @@ exports.defineTags = function(dictionary) {
}) })
.synonym('constructor'); .synonym('constructor');
dictionary.defineTag('interface', {
mustNotHaveValue: true,
onTagged: function(doclet, tag) {
doclet.addTag('kind', 'interface');
}
});
dictionary.defineTag('implements', {
mustHaveValue: true,
onTagText: function(text) {
return text.replace(/(^\{|\}$)/g, '');
},
onTagged: function(doclet, tag) {
if (!doclet.implements) {
doclet.implements = [];
}
doclet.implements.push(tag.value);
}
});
dictionary.defineTag('classdesc', { dictionary.defineTag('classdesc', {
onTagged: function(doclet, tag) { onTagged: function(doclet, tag) {
doclet.classdesc = tag.value; doclet.classdesc = tag.value;
@ -487,6 +468,24 @@ exports.defineTags = function(dictionary) {
} }
}); });
dictionary.defineTag('implements', {
mustHaveValue: true,
onTagText: parseTypeText,
onTagged: function(doclet, tag) {
if (!doclet.implements) {
doclet.implements = [];
}
doclet.implements.push(tag.value);
}
});
dictionary.defineTag('interface', {
mustNotHaveValue: true,
onTagged: function(doclet, tag) {
doclet.addTag('kind', 'interface');
}
});
dictionary.defineTag('kind', { dictionary.defineTag('kind', {
mustHaveValue: true mustHaveValue: true
}); });

View File

@ -54,6 +54,7 @@ MyTester.prototype.it = function() {};
* @interface * @interface
*/ */
function IWorker() {} function IWorker() {}
/** Interface for doing some work. */
IWorker.prototype.work = function() {}; IWorker.prototype.work = function() {};
/** /**
@ -61,6 +62,7 @@ IWorker.prototype.work = function() {};
* @implements {IWorker} * @implements {IWorker}
*/ */
function MyWorker() {} function MyWorker() {}
/** Do some work. */
MyWorker.prototype.work = function() {}; MyWorker.prototype.work = function() {};
MyWorker.prototype.process = function() {}; MyWorker.prototype.process = function() {};