Correct for new dir structure

It looks like a few things have been moved around on the site breaking
the scripts.

Change just shuffles some dirs around to get it working again.
This commit is contained in:
Tom Coupland 2018-11-09 11:07:33 +00:00 committed by Nemo
parent 591e4d875b
commit 56dd68f63d
2 changed files with 9 additions and 7 deletions

View File

@ -2,12 +2,14 @@
# Cleanup
rm -rf html
mkdir -p html
mkdir -p html/index
mkdir -p html/sre-book
cd html
# Download
wget --convert-links --mirror https://landing.google.com/sre/book/
mv landing.google.com/sre/book/* .
mv landing.google.com/sre/sre-book/* ./sre-book
mv landing.google.com/sre/book/index.html ./index
rm -rf landing.google.com
cd ..
@ -17,8 +19,8 @@ fi
ruby generate.rb
pushd html/chapters
pandoc -f html -t epub -o ../../google-sre.epub --epub-metadata=../../metadata.xml --epub-cover-image=../../cover.jpg sre.html
pushd html/sre-book/chapters
pandoc -f html -t epub -o ../../../google-sre.epub --epub-metadata=../../../metadata.xml --epub-cover-image=../../../cover.jpg sre.html
popd
ebook-convert google-sre.epub google-sre.mobi
ebook-convert google-sre.epub google-sre.pdf

View File

@ -3,7 +3,7 @@ require 'pp'
require 'fileutils'
# First we get the list of all the book sections:
chapter_links = Nokogiri::HTML(open("html/index.html"))
chapter_links = Nokogiri::HTML(open("html/index/index.html"))
.css('#drop-down a')
.map {|l| l.attribute('href').value}
@ -11,7 +11,7 @@ html = ''
chapter_links.each do |chapter_link|
chapter_file = File.basename chapter_link
html += "<span class=\"hidden\" name=\"#{chapter_file}\"></span>"
doc = Nokogiri::HTML(open("html/#{chapter_link}"))
doc = Nokogiri::HTML(open("html/index/#{chapter_link}"))
content = doc.css('.content')
# this title is with additional 'chapter X' in front
@ -75,5 +75,5 @@ chapter_links.each do |chapter_link|
html += content.inner_html
end
File.open("html/chapters/sre.html", 'w') { |file| file.write(html) }
File.open("html/sre-book/chapters/sre.html", 'w') { |file| file.write(html) }
puts "[html] Generated HTML file"