The books are now hosted on sre.google instead of landing.google.com

Fix references to the domain, and correct the path to the book as well.
This commit is contained in:
Mads H. Danquah 2020-12-20 14:58:21 +01:00 committed by Nemo
parent 7fae963067
commit 2be3103c32
3 changed files with 17 additions and 14 deletions

View File

@ -9,7 +9,7 @@ BOOKS=(
BOOK_NAME=sre-book
BOOK_NAME_FULL=Site Reliability Engineering
BOOK_FILE=google-site-reliability-engineering
BOOK_TOC_URL=https://landing.google.com/sre/sre-book/toc/index.html
BOOK_TOC_URL=https://sre.google/sre-book/table-of-contents/index.html
'
# Site Reliability Workbook
@ -17,7 +17,7 @@ BOOKS=(
BOOK_NAME=workbook
BOOK_NAME_FULL=The Site Reliability Workbook
BOOK_FILE=google-the-site-reliability-workbook
BOOK_TOC_URL=https://landing.google.com/sre/workbook/toc/index.html
BOOK_TOC_URL=https://sre.google/workbook/table-of-contents/index.html
'
)

View File

@ -4,7 +4,7 @@ require 'fileutils'
# First we get the list of all the book sections:
Dir.chdir("html/landing.google.com/sre/%s/toc" % ENV['BOOK_NAME'])
Dir.chdir("html/sre.google/%s/table-of-contents" % ENV['BOOK_NAME'])
chapter_links = Nokogiri::HTML(open("index.html"))
.css('#drop-down a')
.map {|l| l.attribute('href').value}

View File

@ -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.
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 \