From 30a5480d5751685127783ebb8d45db38a843096d Mon Sep 17 00:00:00 2001 From: Nemo Date: Tue, 7 Nov 2017 03:00:20 +0530 Subject: [PATCH] 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 --- style.css => epub.css | 0 methods.rb | 4 ++-- oathbringer.rb | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) rename style.css => epub.css (100%) diff --git a/style.css b/epub.css similarity index 100% rename from style.css rename to epub.css diff --git a/methods.rb b/methods.rb index 3143a82..2fda623 100644 --- a/methods.rb +++ b/methods.rb @@ -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 diff --git a/oathbringer.rb b/oathbringer.rb index dd408d9..48ae588 100644 --- a/oathbringer.rb +++ b/oathbringer.rb @@ -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