【问题标题】:Polymorphic function documentation in Google Apps ScriptGoogle Apps 脚本中的多态函数文档
【发布时间】:2013-05-05 22:50:45
【问题描述】:
【问题讨论】:
标签:
documentation
google-apps-script
jsdoc
parametric-polymorphism
【解决方案1】:
您可以在 Apps-script 中使用有限的 jsdoc 标记子集,这是无法复制您在服务文档中看到的结果的一个示例。 Here's a list of reported issues with the support of jsdoc in apps-script.
您在应用程序脚本中唯一能做的就是提供有关 cmets 中可选参数的详细文档。不幸的是,这对自动完成毫无帮助。
这是一个基于How to preview jsdoc comments in google doc scripts 的示例,它使用html 表格来模拟@param 标记的输出,并记录了一个方法的两个变体。截图来自库文档 URL,https://script.google.com/macros/library/d/<Library-Id>/<ver>。
/**
* Does incredible things, in a number of amazing ways.
*
* <pre>
* jsdocTest( var1, var2 )
* </pre>
* Description of the first variant.
* <table><tbody>
* <tr><td style="width: 20%"><b>Parameter</b></td><td style="width: 15%"><b>Type</b></td><td style="width: 65%"><b>Description</b></td></tr>
* <tr><td> var1 </td><td> number </td><td> Description of Number Parameter </td></tr>
* <tr><td> var2 </td><td> string </td><td> Description of String Parameter </td></tr>
* </tbody></table>
*
* <pre>
* jsdocTest( var3, var4 )
* </pre>
* Description of the second variant.
* <table><tbody>
* <tr><td style="width: 20%"><b>Parameter</b></td><td style="width: 15%"><b>Type</b></td><td style="width: 65%"><b>Description</b></td></tr>
* <tr><td> var3 </td><td> Object </td><td> Description of Object parameter </td></tr>
* <tr><td> var4 </td><td> String [] </td><td> Description of String Array </td></tr>
* </tbody></table>
*/
function jsdocTest () {
// Handle all parameters via arguments[]
}