update genepub.sh

This commit is contained in:
yetist
2012-10-28 22:31:58 +08:00
parent 81a61b9ced
commit 929b8ef6a6

View File

@@ -3,15 +3,19 @@ if [ ! -f build-web-application-with-golang ];then
go build
fi
if [ ! -d tmp ];then
mkdir tmp
if [ ! -d html ];then
mkdir html
fi
cd tmp
cd html
cp ../*.md .
for i in *.md;do
#重新格式化md文件
sed -i '/^[#]\{1,\}/s!^\([#]\{1,\}\)\([^#]\{1,\}\)!\1 \2!' $i
sed -i '/^[#]\{1,\}/s! ! !' $i
#处理md文件中的image src属性
sed -i '/!\[\](images/s#images\(.*\)?raw=true#../Images\1#' $i
done
../build-web-application-with-golang
../build-web-application-with-golang >/dev/null
rm *.md
echo "文件已经就绪请使用sigil导入html目录中的html文件和images目录中的图片文件制作epub"