Javascript JSDoc don';t分析以逗号为前缀的元素
我正在使用以下Javascript JSDoc don';t分析以逗号为前缀的元素,javascript,jsdoc,Javascript,Jsdoc,我正在使用以下test.js文件尝试JSDoc和Docco: /** * @fileOverview Various tool functions. * @author <a href="mailto:jd@example.com">John Doe</a> * @version 3.1.2 */ /** @namespace util */ var util = { // ## Multiply ## // with this function yo
test.js
文件尝试JSDoc和Docco:
/**
* @fileOverview Various tool functions.
* @author <a href="mailto:jd@example.com">John Doe</a>
* @version 3.1.2
*/
/** @namespace util */
var util = {
// ## Multiply ##
// with this function you can make amazing multiplications!
/**
* Multiplies two numbers
* @param {int} a - a number
* @param {int} b - another number
* @returns {int}
* @example
* var m = util.multiply(2, 3); // 6
*/
multiply: function (a, b){
return a * b;
}
// ## Divide ##
// with this function you can divide two numbers
/**
* Divides two numbers.
* @param {int} a - a number
* @param {int} b - another number
* @returns {int} a/b
*/
, divide: function (a, b) {
// note that if the numbers are not divisible, the result will be a float.
return a / b;
}
};
/**
*@fileOverview各种工具功能。
*@作者
*@version 3.1.2
*/
/**@namespace-util*/
var util={
//##乘##
//使用此函数,您可以进行惊人的乘法运算!
/**
*乘以两个数字
*@param{int}a-一个数字
*@param{int}b-另一个数字
*@returns{int}
*@example
*var m=util.multiply(2,3);//6
*/
乘法:函数(a,b){
返回a*b;
}
//##分割##
//使用此函数可以将两个数除
/**
*除以两个数。
*@param{int}a-一个数字
*@param{int}b-另一个数字
*@returns{int}a/b
*/
,除法:函数(a,b){
//请注意,如果数字不可除,则结果将是浮点。
返回a/b;
}
};
Docco正确输出文档(两个函数都显示),但JSDoc只输出一个,如以下屏幕截图所示:
Docco:
JSDoc:
你知道为什么会发生这种情况吗?看来问题在于。自2013年以来,出现了一个漏洞: 如果我使用
divide
函数从行的beging中删除逗号,并将其添加到multiply
函数的右括号后,JSDoc将正确生成文档:
编辑:添加GitHub问题链接。我创建了一个JSDoc插件来支持逗号优先样式:
我希望它能有所帮助。jsdoc的哪个版本?关于如何“读取”JavaScript的整个底层机制已经改变。对于3.x,这应该可以像预期的那样工作。如果没有,请在Github上提交错误报告。最新版本通过
npm
,3.3.2原样安装。我将提交一个bug报告。@user2864740似乎是一个自2013年以来一直存在的bug: