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;
}
function parseTypeText(text) {
var tagType = jsdoc.tag.type.parse(text, false, true);
return tagType.typeExpression || text;
}
function parseBorrows(doclet, tag) {
var m = /^(\S+)(?:\s+as\s+(\S+))?$/.exec(tag.text);
if (m) {
@ -222,11 +227,7 @@ exports.defineTags = function(dictionary) {
dictionary.defineTag('augments', {
mustHaveValue: true,
// Allow augments value to be specified as a normal type, e.g. {Type}
onTagText: function(text) {
var tagType = jsdoc.tag.type.parse(text, false, true);
return tagType.typeExpression || text;
},
onTagText: parseTypeText,
onTagged: function(doclet, tag) {
doclet.augment( firstWordOf(tag.value) );
}
@ -268,26 +269,6 @@ exports.defineTags = function(dictionary) {
})
.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', {
onTagged: function(doclet, tag) {
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', {
mustHaveValue: true
});

View File

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