简体   繁体   English

将 javadoc 中的链接添加到 google 代码上的源文件

[英]adding links in javadoc to source files on google code

I work on an open source project that is hosted on google code.我从事一个托管在谷歌代码上的开源项目。 I'm using ant to create javadocs and I'd like to have links to the source files.我正在使用 ant 来创建 javadocs,我想要链接到源文件。 I understand I can use the linksource flag to javadoc to include the source in the resulting html, but this isn't what I really want.我知道我可以使用javadoc 的链接源linksource将源包含在生成的 html 中,但这不是我真正想要的。 What I'd prefer is to provide a link to the source file in google code's svn browser.我更喜欢在谷歌代码的 svn 浏览器中提供指向源文件的链接。 I suppose I could do a simple filter prior to running javadoc, but it'd be even better if I could figure a way to do this right in javadoc.我想我可以在运行 javadoc 之前做一个简单的过滤器,但如果我能找到一种在 javadoc 中正确执行此操作的方法会更好。 Ideally, I could have a property in my ant properties file like理想情况下,我可以在我的 ant 属性文件中有一个属性,例如

base.src.url=http://code.google.com/p/myproject/source/browse/branches/1.2

and the javadoc command would add a line to each class's html file:并且 javadoc 命令会在每个类的 html 文件中添加一行:

<a href="http://code.google.com/p/myproject/source/browse/branches/1.2/[package]/[classname].html">see source on google code</a>

Any ideas?有任何想法吗?

The standard doclet offers no such option, as far as I know.据我所知,标准 doclet 没有提供这样的选项。 So it looks you either have to所以看起来你要么必须

  • use an alternative doclet,使用替代 doclet,
  • patch the standard doclet,修补标准 doclet,
  • preprocess the Java files or预处理 Java 文件或
  • postprocess the produced HTML.对生成的 HTML 进行后处理。

A feature request to include this in the standard doclet might also be a good idea.将其包含在标准 doclet 中的功能请求也可能是一个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM