From 76d340b5687ac338f1904dcf8acca8eaac780c07 Mon Sep 17 00:00:00 2001 From: fauno Date: Tue, 10 Jan 2017 15:05:52 -0300 Subject: [PATCH 1/4] fix serious bug on imposition because we were searching for folds the size of the signature, unexpected behaviour ocurred when the total pages were smaller than the signature, leading to missing pages on the final result. halving by the fold size allows to halve by the signature on full folds and by the amount of trailing pages on the incomplete fold. --- lib/jekyll-pandoc-multiple-formats/imposition.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll-pandoc-multiple-formats/imposition.rb b/lib/jekyll-pandoc-multiple-formats/imposition.rb index 7326aaa..4289420 100644 --- a/lib/jekyll-pandoc-multiple-formats/imposition.rb +++ b/lib/jekyll-pandoc-multiple-formats/imposition.rb @@ -68,7 +68,7 @@ def to_nup # Split in halves # [ [ 1, 2, 3, 4, 5, 6, 7, 8 ], # [ 9, 10, 11, 12, 13, 14, '{}', '{}' ] ] - halved = fold.each_slice(@signature / 2).to_a + halved = fold.each_slice(fold.size / 2).to_a # Add a nil as last page. When we reverse it and intercalate by # two pages, we'll have [nil, last_page] instead of # [last_page,second_to_last_page] From e32877c00670da52df59b0d351f0f20c6a392eef Mon Sep 17 00:00:00 2001 From: fauno Date: Tue, 10 Jan 2017 15:10:51 -0300 Subject: [PATCH 2/4] at this point we're already in the source dir --- lib/jekyll-pandoc-multiple-formats/pandoc_file.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb index aa8b881..a145c20 100644 --- a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb +++ b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb @@ -185,13 +185,11 @@ def pdf_cover def pdf_cover! if has_cover? && !File.exists?(pdf_cover) - Dir::chdir(@site.config['source']) do - Open3::popen3("convert \"#{cover}\" \"#{pdf_cover}\"") do |stdin, stdout, stderr, thread| - STDERR.print stderr.read + Open3::popen3("convert \"#{cover}\" \"#{pdf_cover}\"") do |stdin, stdout, stderr, thread| + STDERR.print stderr.read - # Wait for the process to finish - thread.value - end + # Wait for the process to finish + thread.value end end From d56cdbad071712d5a609e9a659fbfc0dd5dcbaac Mon Sep 17 00:00:00 2001 From: fauno Date: Tue, 10 Jan 2017 15:12:37 -0300 Subject: [PATCH 3/4] show a warning when a category and a post share the same file name --- lib/jekyll-pandoc-multiple-formats/generator.rb | 7 +++++++ lib/jekyll-pandoc-multiple-formats/pandoc_file.rb | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/jekyll-pandoc-multiple-formats/generator.rb b/lib/jekyll-pandoc-multiple-formats/generator.rb index 5a57b2c..a8174ea 100644 --- a/lib/jekyll-pandoc-multiple-formats/generator.rb +++ b/lib/jekyll-pandoc-multiple-formats/generator.rb @@ -50,6 +50,13 @@ def generate(site) @site.post_attr_hash('categories').each_pair do |title, posts| posts.sort! pandoc_file = PandocFile.new(@site, output, posts, title) + + if @site.keep_files.include? pandoc_file.relative_path + puts "#{pandoc_file.relative_path} is a category file AND a post file" + puts 'change the category name to fix this' + next + end + next unless pandoc_file.write @site.keep_files << pandoc_file.relative_path diff --git a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb index a145c20..14b698f 100644 --- a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb +++ b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb @@ -41,12 +41,12 @@ def initialize(site, format, posts, title = nil) raise ArgumentError.new "'title' argument is required for multipost file" unless title @title = title - @slug = Utils.slugify(title) else @posts = [posts] - @slug = posts.data['slug'] @title = posts.data['title'] unless title end + + @slug = Utils.slugify(title) end def path From db10d992823336ac3cb59c46c37b500fe4636b68 Mon Sep 17 00:00:00 2001 From: fauno Date: Tue, 10 Jan 2017 15:13:31 -0300 Subject: [PATCH 4/4] 0.2.7 --- lib/jekyll-pandoc-multiple-formats/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll-pandoc-multiple-formats/version.rb b/lib/jekyll-pandoc-multiple-formats/version.rb index f06162d..a49a69c 100644 --- a/lib/jekyll-pandoc-multiple-formats/version.rb +++ b/lib/jekyll-pandoc-multiple-formats/version.rb @@ -1,3 +1,3 @@ module JekyllPandocMultipleFormats - VERSION = '0.2.6' + VERSION = '0.2.7' end