Google Apps 脚本自动生成的库文档 [英] Google Apps Script Auto Generated Library Documentation

本文介绍了Google Apps 脚本自动生成的库文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在为 Google Apps Script 开发一个库,该库基本上将电子表格视为数据库对象.

目前,该库有两个相同的功能,如

/*** 使用给定的 url 打开并创建电子表格的查询对象.** @param {String} 电子表格的网址* @return {SpreadsheetQuery_} 给定电子表格的电子表格查询对象*/函数 openByUrl(url) {返回新的SpreadsheetQuery_(SpreadsheetApp.openByUrl(url));}

现在,对于这两个公共函数,生成的文档仅显示返回类型,而不显示参数和附加说明.我假设这是一个谷歌问题,并没有真正困扰.

但我的主要问题是,由于函数正在从私有函数实例化一个对象,我如何获取自动文档以显示该对象上存在的方法.所有的功能都由对象提供,如果 GAS 可以显示其上的方法就太好了.

注意

<小时>

方法都放在函数的原型上.例如.

<前>SpreadsheetQuery_.prototype.from = 函数(工作表){如果(_.isNumeric(表)){....}

谢谢.

解决方案

为 Google Apps Script 中的库提供支持的 jsdoc 变体不支持您正在寻找的级别的文档,仅支持一级功能.有一个 有关此问题的公开错误报告,但 Google 没有回应.

您仍然可以编写 jsdoc 标签,并在 Google 基础架构之外生成文档.看看如何在google doc脚本中预览jsdoc评论 有关如何预览 jsdoc 注释的一些指示.您可以获取 jsdoc3 的输出并将其发布到网站上,以将您的文档提供给您的社区.

其他相关/可能重复的帖子:

I am currently developing a Library for Google Apps Script that basically treats a spreadsheet as a database object.

Currently, the library has a two identical functions like

/**
* Opens and creates a query object for a spreadsheet with the given url.
*
* @param {String} the url of the spreadsheet
* @return {SpreadsheetQuery_} a spreadsheet query object for the given spreadsheet
*/
function openByUrl(url) {
    return new SpreadsheetQuery_(SpreadsheetApp.openByUrl(url));
}

now, for the two public functions, the documentation generated only shows the return type and not the parameter nor the instructions attached. I am assuming this is a google issue and not really bothered.

But my main question is this, as the functions are instantiating an object from the private function, how can I get the auto documentation to show methods that exist on that object. All the functionality will be provided by the object and it will be great if GAS could show the methods on it.

NOTE


The methods are all placed on the prototype of the function. eg.

SpreadsheetQuery_.prototype.from = function (sheet) {
    if (_.isNumeric(sheet)) {
        ....
}

Thanks.

解决方案

The jsdoc variant suported for libraries in Google Apps Script does not support documentation at the level you are looking for, only first-level functions. There is a relevant open bug report on this, but no response from Google.

You can still write your jsdoc tags, and generate your documentation outside of the Google infrastructure. Take a look at How to preview jsdoc comments in google doc scripts for some pointers on how to preview your jsdoc comments. You could take the output of jsdoc3 and publish it on a site to provide your docs to your community.

Other relevant / possible duplicate posts:

这篇关于Google Apps 脚本自动生成的库文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆