diff --git a/README.md b/README.md index 492099aab339b556fc30ee21890ee852f9c9342c..7a21854a92de8001fa4f8cc77382f23bad802638 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,10 @@ regular jekyll site build. * `sheetsize` is the page size for ready the print PDF. You can also use this option on the front matter. -* `covers_dir` the directory where covers are stored +* `covers_dir` the directory where covers are stored. If you have a + `lang` defined, it will append the language to the `covers_dir` when + looking for a category/full site cover, so you can have localized + covers. * `signature` is the amount of pages per fold on the imposition version. Specify `0` for a single fold of all the pages. You can also use this diff --git a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb index aefcbd6f42af60b7ee8ec93dd025aa04b4af1aab..a320c44b46c448982d4397ff5b6d9b97e6af0adc 100644 --- a/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb +++ b/lib/jekyll-pandoc-multiple-formats/pandoc_file.rb @@ -186,8 +186,8 @@ module Jekyll # Move to the source dir since everything will be relative to that Dir::chdir(@site.config['source']) do # Do the stuff - puts command - Open3::popen3(command) do |stdin, stdout, stderr, thread| + Jekyll.logger.debug command + e = Open3::popen3(command) do |stdin, stdout, stderr, thread| stdin.puts yaml_metadata stdin.puts content stdin.close @@ -196,6 +196,8 @@ module Jekyll # Wait for the process to finish thread.value end + + Jekyll.logger.warn 'Pandoc:', "Failed generating #{path}" if e.to_i > 0 end File.exists?(path) @@ -205,11 +207,19 @@ module Jekyll # # It assumes covers are in PNG format def cover + cover_path = [ @site.config['source'] ] if single_post? && single_post.data['cover'] - File.join(@site.config['source'], single_post.data['cover']) + cover_path << single_post.data['cover'] + elsif site_lang? + cover_path << @config['covers_dir'] + cover_path << site_lang + cover_path << "#{@slug}.png" else - File.join(@site.config['source'], @config['covers_dir'], "#{@slug}.png") + cover_path << @config['covers_dir'] + cover_path << "#{@slug}.png" end + + File.join(cover_path) end # Returns a PDF cover @@ -296,7 +306,10 @@ module Jekyll end def has_cover? - File.exists? cover + e = File.exists? cover + Jekyll.logger.warn "Cover:", "#{cover} missing for #{relative_path}" unless e + + e end def papersize