我正在尝试将customTag添加到jsdoc。我在plugins目录中创建了一个文件,如下所示:
method.js
exports.defineTags = function(dictionary) {
dictionary.defineTag("methodHttp", {
mustHaveValue: true,
canHaveType: false,
canHaveName: true,
onTagged: function(doclet, tag) {
doclet.methodHttp = tag.value;
}
});
};
然后我添加到 conf.json :
{
"tags": {
"allowUnknownTags": true
},
"source": {
"includePattern": ".+\\.js(doc)?$",
"excludePattern": "(^|\\/|\\\\)_"
},
"plugins": [ "plugins/method" ],
"templates": {
"cleverLinks": false,
"monospaceLinks": false,
"default": {
"outputSourceFiles": true
}
},
"jsVersion": 180
}
现在我尝试在我的模板上获取此信息。我在method.tmpl。
我试过了:
self.find('methodHttp')[0]
data.methodHttp[0]
data.methodHttp
但它不起作用。我的代码出了什么问题?
答案 0 :(得分:4)
jsDoc.defineTag
不支持带有大写字符的标记...
虽然这似乎是他们字典中的一个错误!