-
Notifications
You must be signed in to change notification settings - Fork 83
/
build.sh
executable file
·80 lines (62 loc) · 3.38 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh
declare -r BASE_DIR=`dirname $0`
declare -r OUT_DIR=$BASE_DIR/out
declare -r ASSETS_DIR=images
# ================
# Helper functions
# ================
function convert()
{
# echo -e "\t$@"
local src_file=$@
# asciidoctor --trace -v \
asciidoctor \
-d book \
-b html5 \
-a stylesheet=stylesheets/colony.css \
-a linkcss! \
-a icons=font \
-a source-highlighter=highlightjs \
-a toc \
-a toc2 \
-a toclevels=3 \
-a toc=right \
-a idprefix! \
-a idseparator=- \
-a sectanchors \
--compact \
-D $OUT_DIR \
$src_file
}
function makeDir()
{
local target_dir=$1
# create output dir if it doesn't exist
if [ ! -d "$target_dir" ]; then
mkdir -p $target_dir
fi
}
# ===================
# Main flow execution
# ===================
# set -ex
if [ "$1" = "html" ]; then
echo Building book...
makeDir $OUT_DIR
# list all asciidoc files in the DOCS_DIR
adoc_files=(./appendix_a_advancedjs.asciidoc ./appendix_b_html.asciidoc ./appendix_c_ide.asciidoc ./ch10_responsive.asciidoc ./ch11_jquerymobile.asciidoc ./ch12_senchatouch.asciidoc ./ch13_hybrid.asciidoc ./ch1_mockup.asciidoc ./ch2_ajax_json.asciidoc ./ch3_jquery.asciidoc ./ch4_ext_js.asciidoc ./ch5_tools.asciidoc ./ch6_large_js_apps.asciidoc ./ch7_testdriven_js.asciidoc ./ch8_websockets.asciidoc ./ch9_security.asciidoc ./ch_preface.asciidoc ./Introduction.asciidoc ./ch_epilogue.asciidoc )
convert `printf "%s " "${adoc_files[@]}" | cut -d " " -f 1-${#adoc_files[@]}`
asciidoctor -d book -b html5 -a stylesheet=stylesheets/colony.css --out-file out/index.html site.adoc
elif [ "$1" = "clean" ]; then
echo Cleaning files:
rm -rv $OUT_DIR
fi
echo -e "BUILD FINISHED"
#generate book, toclivel attribute is responsible for deep of table of contents
#asciidoc -d book -b html5 -a icons -a iconsdir=images/icons -a theme=flask -a toc2 -a toclevels=3 --out-file out/index.html site.asciidoc
#asciidoctor --trace -v -d book -b html5 -a stylesheet=stylesheets/colony.css -a linkcss! -a icons=font -a source-highlighter=highlightjs -a toc -a toc2 -a toclevels=3 --out-file out/index.html site.asciidoc
# asciidoctor -b docbook -d book -a toc -a numbered -a stylesheet=stylesheets/colony.css -a toc2 -a toclevels=3 -a linkcss! book.asciidoc
#a2x -v -dbook -fchunked --no-xmllint --resource images/ --stylesheet=flask.css --icons --icons-dir=`brew --prefix asciidoc`/etc/asciidoc/images/icons --asciidoc-opts="-a theme=flask -a data-uri -a toc2 -a toclevels=3" --destination-dir=out/ site.asciidoc
#asciidoc -d book -b bootstrap-docs -a icons -a iconsdir=`brew --prefix asciidoc`/etc/asciidoc/images/icons -a data-uri -a toc2 -a toclevels=2 --out-file book.html site.asciidoc
#ubuntu version version of build command
#asciidoc -d book -b html5 -a icons -a iconsdir=/etc/asciidoc/images/icons -a theme=flask -a data-uri -a toc2 -a toclevels=3 book.asciidoc