From 989d5759ceaf5fe22bbb86386df32e83a38eb0bb Mon Sep 17 00:00:00 2001 From: f <f@sutty.nl> Date: Tue, 24 Sep 2019 19:13:46 -0300 Subject: [PATCH] don't rebuild imposed pdfs --- lib/jekyll-pandoc-multiple-formats/printer.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/jekyll-pandoc-multiple-formats/printer.rb b/lib/jekyll-pandoc-multiple-formats/printer.rb index 9ee45a9..e5f2cef 100644 --- a/lib/jekyll-pandoc-multiple-formats/printer.rb +++ b/lib/jekyll-pandoc-multiple-formats/printer.rb @@ -75,7 +75,16 @@ module JekyllPandocMultipleFormats @relative_path ||= Pathname.new(output_file).relative_path_from(Pathname.new(from)).to_s end + def rebuild? + !File.exist?(output_file) || File.ctime(original_file) > File.ctime(output_file) + end + def write + unless rebuild? + Jekyll.logger.info "#{output_file} doesn't need to be rebuilt" + return true + end + # Create the imposed file pdflatex = RTeX::Document.new(template) pdflatex.to_pdf do |pdf_file| -- GitLab