是否可以使用自定义模板在Groovydoc中正确记录Groovy脚本?

发布于 2025-01-30 07:02:44 字数 909 浏览 1 评论 0原文

我有一个令人愉悦的脚本/闭合,该脚本/闭合是在名为“ mycluse.groovy”的文件中定义的,并且内容看起来像这样:

# myClosure.groovy
def call(Map config) {
.....
}

我需要以这种方式保留代码。我想用grovydoc进行记录,但我不确定如何在课程中添加描述。

使用常规类我可以做到这一点:

/**
 * My class 
 */
class myClass {

但是我没有明确的类定义。

groovydoc将其视为:

class myClosure
extends groovy.lang.Script

我可以将文档添加到call()函数中,但是如何使用grovydoc编写班级的描述?这是不可能的: https://ersues.apache.org/jira /浏览/Groovy-8877

是否有某种方法可以更改GroovyDoc模板?

我正在尝试了解自定义模板的内容。它是否要求我覆盖默认模板并复制其所有功能?有什么方法可以将其固定在默认类模板上?例如,可以将其作为这样的自定义标签实现吗?

# would put this comment at top of a groovy script file
/**
 * @override_class_description This is a class that blah
 * blah blah does xyz
 */

I have a groovy script/closure that is defined in a file named "myClosure.groovy" and the contents look like this:

# myClosure.groovy
def call(Map config) {
.....
}

I need to keep the code this way. I want to document this with groovydoc, but I'm not sure how to add a description to the class.

Using a regular class I can do this:

/**
 * My class 
 */
class myClass {

But I have no explicit class definition.

groovydoc sees it as:

class myClosure
extends groovy.lang.Script

I can add docs to the call() function but how can I write a description for the class with groovydoc too? This is not possible out of the box: https://issues.apache.org/jira/browse/GROOVY-8877

Is there some way to alter the class groovydoc template?

I'm trying to understand the custom template thing. Does it require me to override the default template and copy all of its functionality? Is there some way to just staple this on to the default class template? For example, could this be implemented as a custom tag like this?

# would put this comment at top of a groovy script file
/**
 * @override_class_description This is a class that blah
 * blah blah does xyz
 */

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文