Upgrades for pandoc 2.0

- Fixes #7
- Instead of using css/epub_stylesheet rely on the default epub.css
  and set the data-dir to the current directory
This commit is contained in:
Nemo 2017-11-07 03:00:20 +05:30
parent dd0e3a4883
commit 30a5480d57
3 changed files with 4 additions and 3 deletions

View File

View File

@ -41,7 +41,7 @@ def gen_epub(name, format)
to 'epub'
epub_metadata "metadata/#{name}.xml"
epub_cover_image "covers/#{name}.jpg"
epub_stylesheet "style.css"
data_dir Dir.pwd
output "books/#{name}.epub"
end.convert File.read("books/#{name}.html")
puts '[epub] Generated EPUB file'
@ -64,7 +64,7 @@ def gen_pdf(name, format)
if commands?(%w[pandoc convert wkhtmltopdf pdftk]) && format_match(format, :pdf)
# Generate PDF as well
# First, lets make a better css version of the html
`pandoc books/#{name}.html -s -c ../style.css -o books/#{name}_pdf.html`
`pandoc books/#{name}.html -s -c ../epub.css -o books/#{name}_pdf.html`
puts '[pdf] Generated html for pdf'
# Print the pdf_html file to pdf

View File

@ -21,7 +21,8 @@ loop do
month = links.last.split('/').first
day = links.last.split('/')[1]
next_date = Date.new(2017, month.to_i, day.to_i) + 7
links << "#{next_date.strftime('%m')}/#{next_date.strftime('%d')}/oathbringer-by-brandon-sanderson-chapters-#{chapter}-#{chapter + 2}/"
ending_chapter = [chapter+2, 32].min
links << "#{next_date.strftime('%m')}/#{next_date.strftime('%d')}/oathbringer-by-brandon-sanderson-chapters-#{chapter}-#{ending_chapter}/"
chapter += 3
break if next_date + 7 > Date.today
end