forked from Farata/EnterpriseWebBook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·76 lines (58 loc) · 3.18 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
#!/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 \
--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=(./acknowledgements.asciidoc ./appendix_c_ide.asciidoc ./ch10_security.asciidoc ./ch11_responsive.asciidoc ./ch12_jquerymobile.asciidoc ./ch13_senchatouch.asciidoc ./ch14_hybrid.asciidoc ./ch1_advancedjs.asciidoc ./ch2_html.asciidoc ./ch3_mockup.asciidoc ./ch4_ajax_json.asciidoc ./ch5_jquery.asciidoc ./ch6_ext_js.asciidoc ./ch6_5_tools.asciidoc ./ch7_large_js_apps.asciidoc ./ch8_testdriven_js.asciidoc ./ch9_websockets.asciidoc ./Introduction.asciidoc ./ch_preface.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.asciidoc
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