fauno / jekyll-pandoc-multiple-formats

Use pandoc on jekyll to generate posts in multiple formats. Development has moved to https://0xacab.org/edsl/jekyll-pandoc-multiple-formats
https://endefensadelsl.org
Other
88 stars 28 forks source link

Show pandoc errors #8

Closed candlerb closed 10 years ago

candlerb commented 10 years ago

At the moment if pandoc fails, no error is shown.

Suggested simple patch:

--- a/lib/jekyll-pandoc-multiple-formats.rb
+++ b/lib/jekyll-pandoc-multiple-formats.rb
@@ -56,6 +56,7 @@ class PandocGenerator < Generator
         Open3::popen3(pandoc) do |stdin, stdout, stderr|
           stdin.puts content
           stdin.close
+          STDERR.puts stderr.read
         end

         # Skip failed files
@@ -101,6 +102,7 @@ module JekyllPandocMultipleFormats
             stdin.close

             output = stdout.read.strip
+            STDERR.puts stderr.read

           end

As a demonstration, use the default jekyll site and add to _config.yml

pandoc:
  skip: false
  outputs:
    pdf:
    epub:

With this patch you can see the failures:

Brians-MacBook-Air:my-awesome-site $ jekyll build
Configuration file: /Users/brian/tmp/my-awesome-site/_config.yml
            Source: /Users/brian/tmp/my-awesome-site
       Destination: /Users/brian/tmp/my-awesome-site/_site
      Generating... Creating /Users/brian/tmp/my-awesome-site/pdf/jekyll/update/2013/11/20
pandoc  -o /Users/brian/tmp/my-awesome-site/pdf/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.pdf
pandoc: /Users/brian/tmp/my-awesome-site/pdf/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.pdf: openBinaryFile: does not exist (No such file or directory)
Creating /Users/brian/tmp/my-awesome-site/epub/jekyll/update/2013/11/20
pandoc  -o /Users/brian/tmp/my-awesome-site/epub/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.epub
pandoc: /Users/brian/tmp/my-awesome-site/epub/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.epub: openBinaryFile: does not exist (No such file or directory)

done.
candlerb commented 10 years ago

Actually STDERR.print is better than STDERR.puts so you don't get unnecessary blank lines shown when all is working.