File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -3,20 +3,17 @@ if ! which pandoc >/dev/null ;then
3
3
echo " 请先安装pandoc,然后再次运行"
4
4
exit 0
5
5
fi
6
- [ -f build-web-application-with-golang ] || go build
7
- [ -d html ] || mkdir html
8
- pushd html > /dev/null; cp ../* .md .
6
+
9
7
sed -i ' s!https://github.com/astaxie/build-web-application-with-golang/blob/master/!!g' README.md
10
8
for i in * .md; do
11
9
# 重新格式化md文件
12
10
sed -i ' /^[#]\{1,\}/s!^\([#]\{1,\}\)\([^#]\{1,\}\)!\1 \2!' $i # 以#开头的行,在#后增加空格
13
11
sed -i ' /^[#]\{1,\}/s! ! !' $i # 以#开头的行, 删除多余的空格
14
12
# sed -i '/!\[\](images/s#images\(.*\)?raw=true#../Images\1#' $i
15
- sed -i ' /!\[\](images/s#images\(.*\)?raw=true#../images\1#' $i # 处理md文件中的image src属性
13
+ # sed -i '/!\[\](images/s#images\(.*\)?raw=true#../images\1#' $i #处理md文件中的image src属性
16
14
sed -i ' /[#]\{2,\} links/,/[ ]\{0,\}Id\$.*/d' $i # 删除页面链接
17
15
done
18
- ../build-web-application-with-golang > /dev/null
19
- list=" README.html ` ls [0-9]* .html | sort -h` LICENSE.html"
16
+ list=" ` ls [0-9]* .html | sort ` "
20
17
cat > metadata.txt << EOF
21
18
<dc:creator>Astaxie</dc:creator>
22
19
<dc:description>一本开源的Go Web编程书籍</dc:description>
27
24
28
25
pandoc --reference-links -S --toc -f html -t epub --epub-metadata=metadata.txt --epub-cover-image=../images/cover.png \
29
26
-o ../build-web-application-with-golang.epub $list
30
- popd > /dev/null
27
+
31
28
rm -rf html
32
29
echo " build-web-application-with-golang.epub 已经建立"
Original file line number Diff line number Diff line change
1
+ ebook/images/
You can’t perform that action at this time.
0 commit comments