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:
parent
dd0e3a4883
commit
30a5480d57
|
@ -41,7 +41,7 @@ def gen_epub(name, format)
|
||||||
to 'epub'
|
to 'epub'
|
||||||
epub_metadata "metadata/#{name}.xml"
|
epub_metadata "metadata/#{name}.xml"
|
||||||
epub_cover_image "covers/#{name}.jpg"
|
epub_cover_image "covers/#{name}.jpg"
|
||||||
epub_stylesheet "style.css"
|
data_dir Dir.pwd
|
||||||
output "books/#{name}.epub"
|
output "books/#{name}.epub"
|
||||||
end.convert File.read("books/#{name}.html")
|
end.convert File.read("books/#{name}.html")
|
||||||
puts '[epub] Generated EPUB file'
|
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)
|
if commands?(%w[pandoc convert wkhtmltopdf pdftk]) && format_match(format, :pdf)
|
||||||
# Generate PDF as well
|
# Generate PDF as well
|
||||||
# First, lets make a better css version of the html
|
# 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'
|
puts '[pdf] Generated html for pdf'
|
||||||
|
|
||||||
# Print the pdf_html file to pdf
|
# Print the pdf_html file to pdf
|
||||||
|
|
|
@ -21,7 +21,8 @@ loop do
|
||||||
month = links.last.split('/').first
|
month = links.last.split('/').first
|
||||||
day = links.last.split('/')[1]
|
day = links.last.split('/')[1]
|
||||||
next_date = Date.new(2017, month.to_i, day.to_i) + 7
|
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
|
chapter += 3
|
||||||
break if next_date + 7 > Date.today
|
break if next_date + 7 > Date.today
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue