Files
build-web-application-with-…/genepub.sh
2012-10-29 17:24:07 +08:00

22 lines
516 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
if [ ! -f build-web-application-with-golang ];then
go build
fi
if [ ! -d html ];then
mkdir html
fi
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 >/dev/null
rm *.md
echo "文件已经就绪请使用sigil导入html目录中的html文件和images目录中的图片文件制作epub"