-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsliderize.sh
executable file
·214 lines (152 loc) · 5.59 KB
/
sliderize.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/bin/sh
TARGET="doc"
if [ "$#" -eq 0 ]
then
echo "No script arguments."
else
echo "Script arguments: ${#}"
echo "Script argument #1 (TARGET): ${1}"
TARGET=${1}
fi
#VERBOSITY="VERBOSE_min"
#VERBOSITY="VERBOSE_medium"
#VERBOSITY="VERBOSE_max" ===> triggers special "author" mode with Markdown editor (HTML mode)
# FIRST PASS => XHTML (EPUB3 ZIP)
VERBOSITY="VERBOSE_min"
root=$(pwd)
DATA_file="${root}/_INPUT/${TARGET}/data.txt"
if [ -f ${DATA_file} ]
then
echo "Data file found: ${DATA_file}"
else
echo "Data file not found! ${DATA_file}"
exit
fi
EPUB_FILENAME="EPUB3-Sliderizer"
if [ "${TARGET}" != "doc" ]
then
EPUB_FILENAME="EPUB3-Sliderizer_${TARGET}"
fi
echo "EPUB file: ${EPUB_FILENAME}"
rm -r ./_OUTPUT
mkdir ./_OUTPUT
#cp -r ./tool/readium ./_OUTPUT/
mkdir ./_OUTPUT/content
cp -r ./tool/EPUB3 ./_OUTPUT/content/
#mv ./_OUTPUT/readium/index.html ./_OUTPUT/content/
bin="${root}/tool/epub3-sliderizer/bin/"
if [ -f ${bin} ]; then
echo "Build directory found: ${bin}"
else
echo "MKDIR: ${bin}"
mkdir "${bin}"
fi
cd ./tool/epub3-sliderizer/
pwd
class="./bin/Main.clazz"
if [ -f ${class} ]; then
echo "Class found: ${class}"
else
echo "Compiling: ${class}"
javac -classpath ".:${root}/tool/epub3-sliderizer/lib/guava-15.0.jar:${root}/tool/epub3-sliderizer/lib/mustache-compiler-0.8.13.jar:${root}/tool/epub3-sliderizer/lib/asm-all-4.1.jar:${root}/tool/epub3-sliderizer/lib/parboiled-core-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/parboiled-java-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/pegdown-1.4.1.jar:${root}/tool/epub3-sliderizer/lib/jsoup-1.7.2.jar" "${root}/tool/epub3-sliderizer/src/Main.java" -d "${bin}" -sourcepath "${root}/tool/epub3-sliderizer/src" #-verbose
exitValue=$?
echo "[INFO] javac: ${exitValue}"
if [ $exitValue != 0 ]
then
echo "Compilation error?"
exit $exitValue
fi
fi
DATA_url="file://${DATA_file}"
EPUB_FOLDER="${root}/_OUTPUT/content/EPUB3/epub"
echo "EPUB3-Sliderization in progress..."
echo ${DATA_file}
echo ${EPUB_FOLDER}
########################################################################################
java -classpath "${root}/tool/epub3-sliderizer/lib/guava-15.0.jar:${root}/tool/epub3-sliderizer/lib/mustache-compiler-0.8.13.jar:${root}/tool/epub3-sliderizer/lib/asm-all-4.1.jar:${root}/tool/epub3-sliderizer/lib/parboiled-core-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/parboiled-java-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/pegdown-1.4.1.jar:${root}/tool/epub3-sliderizer/lib/jsoup-1.7.2.jar:${bin}" Main ${DATA_url} ${EPUB_FOLDER} ${VERBOSITY}
exitValue=$?
echo "[INFO] java (sliderize XHTML): ${exitValue}"
if [ $exitValue != 0 ]
then
echo "Execution error?"
exit $exitValue
fi
#open ${EPUB_FOLDER}
#exit
########################################################################################
cd ${root}
#### TODO REMOVE!!!
#exit
cp -r _OUTPUT/content/EPUB3 ../readium-js-viewer/epub_content/
#mv "${root}/_OUTPUT/content/EPUB3/epub/js/aloha/" "${root}/_OUTPUT/content/"
############################################################
./pack-epub.sh
############################################################
exitValue=$?
echo "[INFO] pack-epub.sh: ${exitValue}"
if [ $exitValue != 0 ]
then
echo "PACK EPUB error? (rebuilding ZIP)"
./zipEpub.sh
fi
mv "${root}/_OUTPUT/content/EPUB3-Sliderizer.epub" "${root}/_OUTPUT/content/${EPUB_FILENAME}.epub"
if [ $exitValue != 0 ]
then
exit $exitValue
fi
####### exit
#
# ########################################################################################
#
# cd ./tool/epub3-sliderizer/
#
# java -classpath "${root}/tool/epub3-sliderizer/lib/guava-15.0.jar:${root}/tool/epub3-sliderizer/lib/mustache-compiler-0.8.13.jar:${root}/tool/epub3-sliderizer/lib/asm-all-4.1.jar:${root}/tool/epub3-sliderizer/lib/parboiled-core-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/parboiled-java-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/pegdown-1.4.1.jar:${root}/tool/epub3-sliderizer/lib/jsoup-1.7.2.jar:${bin}" Main ${DATA_url} ${EPUB_FOLDER} ${VERBOSITY} REFLOWABLE
#
# exitValue=$?
#
# echo "[INFO] java (sliderize XHTML reflowable): ${exitValue}"
#
# if [ $exitValue != 0 ]
# then
# echo "Execution error?"
# exit $exitValue
# fi
#
# ########################################################################################
#
# cd ${root}
#
# #mv "${root}/_OUTPUT/content/EPUB3/epub/js/aloha/" "${root}/_OUTPUT/content/"
#
# ############################################################
# ./pack-epub.sh
# ############################################################
#
# exitValue=$?
#
# echo "[INFO] pack-epub.sh: ${exitValue}"
#
# if [ $exitValue != 0 ]
# then
# echo "PACK EPUB error?"
# exit $exitValue
# fi
#
# mv "${root}/_OUTPUT/content/EPUB3-Sliderizer.epub" "${root}/_OUTPUT/content/${EPUB_FILENAME}_REFLOW.epub"
#
# #mv "${root}/_OUTPUT/content/aloha/" "${root}/_OUTPUT/content/EPUB3/epub/js/"
#
# ########################################################################################
######## exit
cd ./tool/epub3-sliderizer/
# SECOND PASS => HTML content editable author mode
VERBOSITY="VERBOSE_max"
java -classpath "${root}/tool/epub3-sliderizer/lib/guava-15.0.jar:${root}/tool/epub3-sliderizer/lib/mustache-compiler-0.8.13.jar:${root}/tool/epub3-sliderizer/lib/asm-all-4.1.jar:${root}/tool/epub3-sliderizer/lib/parboiled-core-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/parboiled-java-1.1.6.jar:${root}/tool/epub3-sliderizer/lib/pegdown-1.4.1.jar:${root}/tool/epub3-sliderizer/lib/jsoup-1.7.2.jar:${bin}" Main ${DATA_url} ${EPUB_FOLDER} ${VERBOSITY}
exitValue=$?
echo "[INFO] java (sliderize HTML): ${exitValue}"
if [ $exitValue != 0 ]
then
echo "Execution error?"
exit $exitValue
fi
cd ${root}