javadoc 创建html,创建使用favicon的Javadoc HTML页面

马库斯的解决方案是一个良好的开端。谢谢你提供它!

然而,它有一些问题:

如果目录不包含任何.html文件,则会创建一个文件

名为*.html。

它不会向JDK 8版本的javadoc生成的HTML文件添加favicon,该版本使用

而不是。

如果多次运行,它会多次插入favicon。

mktemp命令不可移植(例如,在Mac OS上不起作用)。

它不保留文件权限。

这是一个纠正这些问题的版本。可以在expanded version存储库中找到html-tools。如果您发现问题或想提出改进建议,请在此处发表评论或使用html-tools issue tracker。

#!/bin/sh

# Add favicon to header of HTML files.

# One use case is for javadoc-generated API documentation.

#

# Run like this:

# add-favicon

# The arguments should be paths relative to the current working directory.

# Once this has been run, running it another time has no effect.

patchIt () {

for f in $1/*.html ; do

if [ -f "$f" ]; then # if no .html files exist, f is literal "*.html"

tmpfile=`mktemp patch_favicon_XXXXX`

# This creates tmpfile, with the same permissions as $f.

# The next command will overwrite it but preserve the permissions.

# Hat tip to http://superuser.com/questions/170226/standard-way-to-duplicate-a-files-permissions for this trick.

\cp -p $f $tmpfile

sed -e " s%

\$%%" $f > $tmpfile

mv -f $tmpfile $f

fi;

done ;

for d in $1/* ; do

if [ -d $d ]; then echo "descending to "$d ; patchIt $d ../$2 ; fi ;

done

}

patchIt $1 $2

#eof

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值