开发者

With the javadoc target in Apache Ant, is it possible to make all external links open in a new window

开发者 https://www.devze.com 2023-01-14 02:01 出处:网络
The Apache Ant javadoc target allows a <link> attribute to link to external javadocs. I would like these javadocs to open in a new window (like target=\"_blank\"), but the link attribute doesn\'

The Apache Ant javadoc target allows a <link> attribute to link to external javadocs. I would like these javadocs to open in a new window (like target="_blank"), but the link attribute doesn't accept a <target> attribute that would al开发者_JAVA技巧low me to do something like this. Is there some other way to do this apart from manually editing the links after they are generated?


The "bottom" element can be used in javadoc ant task. It injects html code into each files.

<javadoc .....>
    <!--
    .....
    -->
    <bottom>
    &lt;script&gt;
    for(var i in document.links) {
        var link = document.links[i];
        if (link.href.indexOf('http') === 0) { 
            link.target = '_blank';
        }
    }
    &lt;/script&gt;
    </bottom>
</javadoc>
0

精彩评论

暂无评论...
验证码 换一张
取 消