插入“最后修改时间” javadoc 页脚中的时间戳

发布于 2024-11-16 03:28:05 字数 166 浏览 4 评论 0原文

有没有办法指定类文件的最后修改日期?我希望每个 javadoc 页面都包含类文件的最后修改时间戳,最好在页脚中。

我以为我前段时间做过类似的事情,但在网上找不到任何示例,而且页脚的文档只是表明它可以包含h​​tml。那么它不能有任何类型的占位符在生成 javadoc 时设置吗?

谢谢。

Is there a way to specify the last modified date of the class file? I'd like each javadoc page to have the last modified timestamp of the class file included, preferrably in the footer.

I thought I had done something like this some time ago, but can't find any examples on the web, and the documentation for footer simply indicates that it can contain html. So can it not have any kind of place holder that will be set when the javadoc is generated?

Thanks.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ペ泪落弦音 2024-11-23 03:28:05

某些源代码控制系统允许您编写一个标记,该标记在您提交文件时会更新。如果将其放入 javadoc 中,javadoc 将告诉您修订号以及上次提交的时间。

Some source control systems allow you to code a marker that's updated when you commit the file. If you put that inside javadoc, the javadoc will tell you the revision number and when it was last committed.

情场扛把子 2024-11-23 03:28:05

我认为 javadoc 中没有此功能。为什么不依靠源代码管理来为您完成这项工作呢?如果是 SVN,您可以定义关键字,这些关键字将在提交时自动填充(请参阅 svn道具集)。这要好得多,您无需担心 javadoc 处理。

如果更简单的方法可以满足,您可以在底部选项中添加一个脚本,例如:

-bottom "<font size=\"-1\">Created by `echo $USER`, at `date +%Y-%m-%d\ %H:%M:%S.%N`.</font>"

I don't think this feature is available in javadoc. Why don't you rely on the source control to do this work for you? You can have, if SVN, defined keywords that will automatically be filled upon commit (see svn propset). This is much better and you don't need to worry about the javadoc processing.

If a simpler approach can satisfy, you may just add a script into the bottom option, like:

-bottom "<font size=\"-1\">Created by `echo $USER`, at `date +%Y-%m-%d\ %H:%M:%S.%N`.</font>"
混浊又暗下来 2024-11-23 03:28:05

我认为将时间戳写入代码中是编辑器的工作。这就是 Emacs 的做法:

package my.tuple;

/**
 * Implementation of an ordered 2-tuple.
 *
 * @date 2013-07-03
 */

public class Pair<A,B>
{
}

// Local Variables:
// time-stamp-pattern: "0/^ \\* @date %:y-%02m-%02d$"
// End:

之后文档处理器可以读取日期。但标准 javadoc 不知道日期。为此,您需要 Eclipse 或 Doxygen。

I think it is the job of the editor to write the time stamp into the code. This is how Emacs does it:

package my.tuple;

/**
 * Implementation of an ordered 2-tuple.
 *
 * @date 2013-07-03
 */

public class Pair<A,B>
{
}

// Local Variables:
// time-stamp-pattern: "0/^ \\* @date %:y-%02m-%02d$"
// End:

After that the document processor can read the date. But the standard javadoc is not aware of dates. You need Eclipse or Doxygen for this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文