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:
parent
591e4d875b
commit
56dd68f63d
10
bootstrap.sh
10
bootstrap.sh
|
@ -2,12 +2,14 @@
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
rm -rf html
|
rm -rf html
|
||||||
mkdir -p html
|
mkdir -p html/index
|
||||||
|
mkdir -p html/sre-book
|
||||||
cd html
|
cd html
|
||||||
|
|
||||||
# Download
|
# Download
|
||||||
wget --convert-links --mirror https://landing.google.com/sre/book/
|
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
|
rm -rf landing.google.com
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
@ -17,8 +19,8 @@ fi
|
||||||
|
|
||||||
ruby generate.rb
|
ruby generate.rb
|
||||||
|
|
||||||
pushd html/chapters
|
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
|
pandoc -f html -t epub -o ../../../google-sre.epub --epub-metadata=../../../metadata.xml --epub-cover-image=../../../cover.jpg sre.html
|
||||||
popd
|
popd
|
||||||
ebook-convert google-sre.epub google-sre.mobi
|
ebook-convert google-sre.epub google-sre.mobi
|
||||||
ebook-convert google-sre.epub google-sre.pdf
|
ebook-convert google-sre.epub google-sre.pdf
|
||||||
|
|
|
@ -3,7 +3,7 @@ require 'pp'
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
# First we get the list of all the book sections:
|
# 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')
|
.css('#drop-down a')
|
||||||
.map {|l| l.attribute('href').value}
|
.map {|l| l.attribute('href').value}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ html = ''
|
||||||
chapter_links.each do |chapter_link|
|
chapter_links.each do |chapter_link|
|
||||||
chapter_file = File.basename chapter_link
|
chapter_file = File.basename chapter_link
|
||||||
html += "<span class=\"hidden\" name=\"#{chapter_file}\"></span>"
|
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')
|
content = doc.css('.content')
|
||||||
|
|
||||||
# this title is with additional 'chapter X' in front
|
# this title is with additional 'chapter X' in front
|
||||||
|
@ -75,5 +75,5 @@ chapter_links.each do |chapter_link|
|
||||||
html += content.inner_html
|
html += content.inner_html
|
||||||
end
|
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"
|
puts "[html] Generated HTML file"
|
||||||
|
|
Loading…
Reference in New Issue