|
|
|
@ -15,7 +15,7 @@ IMGS_DOMAIN="lh3.googleusercontent.com"
|
|
|
|
|
# Make sure that links are relative \
|
|
|
|
|
# # Remove the /sre/ directories
|
|
|
|
|
# Save stuff in html/ directory
|
|
|
|
|
# Do not create a landing.google.com directory
|
|
|
|
|
# Do not create a sre.google directory
|
|
|
|
|
# Enable recursion, timestamping (--mirror)
|
|
|
|
|
# Images are hosted elsewhere, download them as well.
|
|
|
|
|
# We need to go up a level from /toc/ where we start
|
|
|
|
@ -31,7 +31,7 @@ wget \
|
|
|
|
|
--mirror \
|
|
|
|
|
--no-verbose \
|
|
|
|
|
--recursive \
|
|
|
|
|
--domains=${IMGS_DOMAIN},landing.google.com ${BOOK_TOC_URL} || true
|
|
|
|
|
--domains=${IMGS_DOMAIN},sre.google ${BOOK_TOC_URL} || true
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
echo "Get working mode..."
|
|
|
|
@ -53,8 +53,11 @@ for FILE_NAME_FULL in ${IMGS_FILES}; do
|
|
|
|
|
FILE_TYPE=$(file -b -- "${FILE_NAME_FULL}" | cut -f1 -d " ")
|
|
|
|
|
|
|
|
|
|
# Rename and replace file.
|
|
|
|
|
mv "${FILE_NAME_FULL}" "${FILE_NAME_FULL}.${FILE_TYPE,,}" &&
|
|
|
|
|
grep -rl -- "${FILE_NAME_BASE}" ./html | xargs sed -i -- "s/${FILE_NAME_BASE}/${FILE_NAME_BASE}.${FILE_TYPE,,}/g"
|
|
|
|
|
if grep -rl -- "${FILE_NAME_BASE}" ./html; then
|
|
|
|
|
mv "${FILE_NAME_FULL}" "${FILE_NAME_FULL}.${FILE_TYPE,,}" &&
|
|
|
|
|
grep -rl -- "${FILE_NAME_BASE}" ./html | xargs sed -i -- "s/${FILE_NAME_BASE}/${FILE_NAME_BASE}.${FILE_TYPE,,}/g"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
@ -66,18 +69,18 @@ fi
|
|
|
|
|
# Generate epub from html.
|
|
|
|
|
echo "Generate book ..."
|
|
|
|
|
bundle exec ruby generate.rb
|
|
|
|
|
pushd html/landing.google.com/sre/${BOOK_NAME}/toc
|
|
|
|
|
pushd html/sre.google/${BOOK_NAME}/table-of-contents
|
|
|
|
|
pandoc --from=html --to=epub \
|
|
|
|
|
--output=../../../../../${BOOK_FILE}.epub \
|
|
|
|
|
--epub-metadata=../../../../../metadata/${BOOK_NAME}.xml \
|
|
|
|
|
--epub-cover-image=../../../../../cover/${BOOK_NAME}.jpg \
|
|
|
|
|
--output=../../../../${BOOK_FILE}.epub \
|
|
|
|
|
--epub-metadata=../../../../metadata/${BOOK_NAME}.xml \
|
|
|
|
|
--epub-cover-image=../../../../cover/${BOOK_NAME}.jpg \
|
|
|
|
|
--metadata title="$BOOK_NAME" \
|
|
|
|
|
complete.html
|
|
|
|
|
|
|
|
|
|
# generate PDF from HTML
|
|
|
|
|
pandoc --from=html \
|
|
|
|
|
--pdf-engine=xelatex \
|
|
|
|
|
--output=../../../../../${BOOK_FILE}.pdf \
|
|
|
|
|
--output=../../../../${BOOK_FILE}.pdf \
|
|
|
|
|
--metadata title="$BOOK_NAME" \
|
|
|
|
|
--dpi=300 \
|
|
|
|
|
-V book \
|
|
|
|
@ -86,8 +89,8 @@ pandoc --from=html \
|
|
|
|
|
-V lang=en-US \
|
|
|
|
|
-V classoption=oneside \
|
|
|
|
|
-V titlepage=true \
|
|
|
|
|
-V logo=../../../../../cover/${BOOK_NAME}.jpg \
|
|
|
|
|
-V titlepage-background=../../../../../cover/${BOOK_NAME}.jpg \
|
|
|
|
|
-V logo=../../../../cover/${BOOK_NAME}.jpg \
|
|
|
|
|
-V titlepage-background=../../../../cover/${BOOK_NAME}.jpg \
|
|
|
|
|
-V toc-own-page=true \
|
|
|
|
|
-V footnotes-pretty=true \
|
|
|
|
|
-V subparagraph \
|
|
|
|
|