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:
parent
7fae963067
commit
758aef7043
4
books.sh
4
books.sh
|
@ -9,7 +9,7 @@ BOOKS=(
|
||||||
BOOK_NAME=sre-book
|
BOOK_NAME=sre-book
|
||||||
BOOK_NAME_FULL=Site Reliability Engineering
|
BOOK_NAME_FULL=Site Reliability Engineering
|
||||||
BOOK_FILE=google-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
|
# Site Reliability Workbook
|
||||||
|
@ -17,7 +17,7 @@ BOOKS=(
|
||||||
BOOK_NAME=workbook
|
BOOK_NAME=workbook
|
||||||
BOOK_NAME_FULL=The Site Reliability Workbook
|
BOOK_NAME_FULL=The Site Reliability Workbook
|
||||||
BOOK_FILE=google-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
|
||||||
'
|
'
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,7 +4,7 @@ require 'fileutils'
|
||||||
|
|
||||||
# First we get the list of all the book sections:
|
# 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"))
|
chapter_links = Nokogiri::HTML(open("index.html"))
|
||||||
.css('#drop-down a')
|
.css('#drop-down a')
|
||||||
.map {|l| l.attribute('href').value}
|
.map {|l| l.attribute('href').value}
|
||||||
|
|
25
generate.sh
25
generate.sh
|
@ -15,7 +15,7 @@ IMGS_DOMAIN="lh3.googleusercontent.com"
|
||||||
# Make sure that links are relative \
|
# Make sure that links are relative \
|
||||||
# # Remove the /sre/ directories
|
# # Remove the /sre/ directories
|
||||||
# Save stuff in html/ directory
|
# Save stuff in html/ directory
|
||||||
# Do not create a landing.google.com directory
|
# Do not create a sre.google directory
|
||||||
# Enable recursion, timestamping (--mirror)
|
# Enable recursion, timestamping (--mirror)
|
||||||
# Images are hosted elsewhere, download them as well.
|
# Images are hosted elsewhere, download them as well.
|
||||||
# We need to go up a level from /toc/ where we start
|
# We need to go up a level from /toc/ where we start
|
||||||
|
@ -31,7 +31,7 @@ wget \
|
||||||
--mirror \
|
--mirror \
|
||||||
--no-verbose \
|
--no-verbose \
|
||||||
--recursive \
|
--recursive \
|
||||||
--domains=${IMGS_DOMAIN},landing.google.com ${BOOK_TOC_URL} || true
|
--domains=${IMGS_DOMAIN},sre.google ${BOOK_TOC_URL} || true
|
||||||
|
|
||||||
#
|
#
|
||||||
echo "Get working mode..."
|
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 " ")
|
FILE_TYPE=$(file -b -- "${FILE_NAME_FULL}" | cut -f1 -d " ")
|
||||||
|
|
||||||
# Rename and replace file.
|
# Rename and replace file.
|
||||||
mv "${FILE_NAME_FULL}" "${FILE_NAME_FULL}.${FILE_TYPE,,}" &&
|
if grep -rl -- "${FILE_NAME_BASE}" ./html; then
|
||||||
grep -rl -- "${FILE_NAME_BASE}" ./html | xargs sed -i -- "s/${FILE_NAME_BASE}/${FILE_NAME_BASE}.${FILE_TYPE,,}/g"
|
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
|
done
|
||||||
|
|
||||||
|
@ -66,18 +69,18 @@ fi
|
||||||
# Generate epub from html.
|
# Generate epub from html.
|
||||||
echo "Generate book ..."
|
echo "Generate book ..."
|
||||||
bundle exec ruby generate.rb
|
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 \
|
pandoc --from=html --to=epub \
|
||||||
--output=../../../../../${BOOK_FILE}.epub \
|
--output=../../../../${BOOK_FILE}.epub \
|
||||||
--epub-metadata=../../../../../metadata/${BOOK_NAME}.xml \
|
--epub-metadata=../../../../metadata/${BOOK_NAME}.xml \
|
||||||
--epub-cover-image=../../../../../cover/${BOOK_NAME}.jpg \
|
--epub-cover-image=../../../../cover/${BOOK_NAME}.jpg \
|
||||||
--metadata title="$BOOK_NAME" \
|
--metadata title="$BOOK_NAME" \
|
||||||
complete.html
|
complete.html
|
||||||
|
|
||||||
# generate PDF from HTML
|
# generate PDF from HTML
|
||||||
pandoc --from=html \
|
pandoc --from=html \
|
||||||
--pdf-engine=xelatex \
|
--pdf-engine=xelatex \
|
||||||
--output=../../../../../${BOOK_FILE}.pdf \
|
--output=../../../../${BOOK_FILE}.pdf \
|
||||||
--metadata title="$BOOK_NAME" \
|
--metadata title="$BOOK_NAME" \
|
||||||
--dpi=300 \
|
--dpi=300 \
|
||||||
-V book \
|
-V book \
|
||||||
|
@ -86,8 +89,8 @@ pandoc --from=html \
|
||||||
-V lang=en-US \
|
-V lang=en-US \
|
||||||
-V classoption=oneside \
|
-V classoption=oneside \
|
||||||
-V titlepage=true \
|
-V titlepage=true \
|
||||||
-V logo=../../../../../cover/${BOOK_NAME}.jpg \
|
-V logo=../../../../cover/${BOOK_NAME}.jpg \
|
||||||
-V titlepage-background=../../../../../cover/${BOOK_NAME}.jpg \
|
-V titlepage-background=../../../../cover/${BOOK_NAME}.jpg \
|
||||||
-V toc-own-page=true \
|
-V toc-own-page=true \
|
||||||
-V footnotes-pretty=true \
|
-V footnotes-pretty=true \
|
||||||
-V subparagraph \
|
-V subparagraph \
|
||||||
|
|
Loading…
Reference in New Issue