From d67975c84d4c0de906a3e3f011b3303627cf3204 Mon Sep 17 00:00:00 2001 From: Wu Yinghao Date: Sun, 7 Jul 2013 12:57:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86genepub.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在根目录添加了一个目录链接images 修改了genepub.sh,取消了一些东西 --- ebook/genepub.sh | 11 ++++------- images | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) mode change 100644 => 100755 ebook/genepub.sh create mode 120000 images diff --git a/ebook/genepub.sh b/ebook/genepub.sh old mode 100644 new mode 100755 index 81c4a758..f769cf2a --- a/ebook/genepub.sh +++ b/ebook/genepub.sh @@ -3,20 +3,17 @@ if ! which pandoc >/dev/null ;then echo "请先安装pandoc,然后再次运行" exit 0 fi -[ -f build-web-application-with-golang ] || go build -[ -d html ] || mkdir html -pushd html >/dev/null; cp ../*.md . + sed -i 's!https://github.com/astaxie/build-web-application-with-golang/blob/master/!!g' README.md for i in *.md;do #重新格式化md文件 sed -i '/^[#]\{1,\}/s!^\([#]\{1,\}\)\([^#]\{1,\}\)!\1 \2!' $i #以#开头的行,在#后增加空格 sed -i '/^[#]\{1,\}/s! ! !' $i #以#开头的行, 删除多余的空格 #sed -i '/!\[\](images/s#images\(.*\)?raw=true#../Images\1#' $i - sed -i '/!\[\](images/s#images\(.*\)?raw=true#../images\1#' $i #处理md文件中的image src属性 + #sed -i '/!\[\](images/s#images\(.*\)?raw=true#../images\1#' $i #处理md文件中的image src属性 sed -i '/[#]\{2,\} links/,/[ ]\{0,\}Id\$.*/d' $i #删除页面链接 done -../build-web-application-with-golang >/dev/null -list="README.html `ls [0-9]*.html |sort -h` LICENSE.html" +list="`ls [0-9]*.html |sort `" cat > metadata.txt <Astaxie 一本开源的Go Web编程书籍 @@ -27,6 +24,6 @@ EOF pandoc --reference-links -S --toc -f html -t epub --epub-metadata=metadata.txt --epub-cover-image=../images/cover.png \ -o ../build-web-application-with-golang.epub $list -popd >/dev/null + rm -rf html echo "build-web-application-with-golang.epub 已经建立" diff --git a/images b/images new file mode 120000 index 00000000..e0bc9c2a --- /dev/null +++ b/images @@ -0,0 +1 @@ +ebook/images/ \ No newline at end of file