Closed candlerb closed 10 years ago
Here is the result of adding some STDERR.puts lines
base_dir="./tmp"
output="pdf"
File.dirname(post.url)="/jekyll/update/2013/11/20"
post_path="./tmp/pdf/jekyll/update/2013/11/20"
Creating ./tmp/pdf/jekyll/update/2013/11/20
filename="/jekyll/update/2013/11/20/welcome-to-jekyll.pdf"
filename_with_path="./tmp/pdf/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.pdf"
pandoc -o ./tmp/pdf/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.pdf
pandoc: ./tmp/pdf/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.pdf: openBinaryFile: does not exist (No such file or directory)
This simple fix makes it work:
--- a/lib/jekyll-pandoc-multiple-formats.rb
+++ b/lib/jekyll-pandoc-multiple-formats.rb
@@ -27,7 +27,7 @@ class PandocGenerator < Generator
# Have a filename!
filename = "#{post.url.gsub(/\//, "-").gsub(/-$/, "")}.#{output}" if filename =~ /\/$/
- filename_with_path = File.join(post_path, filename)
+ filename_with_path = File.join(base_dir, output, filename)
# Special cases, stdout is disabled for these
if ['pdf', 'epub', 'odt', 'docx'].include?(output)
but I can't see how it could have worked before without this.
thanks! if you do the pull request(s) i'll merge your changes :)
Is there any pull request done @fauno @candlerb ?
This is someone else's code which, as I said, I don't understand why it was written the way it was. I think the author needs to make a decision as to whether the frig patch I made is in fact the correct solution, or there is something else underlying which needs to be changed.
the patch is already applied
i guess since it was so simple i just went ahead and applied it
Using the default my-awesome-site jekyll site, with
Jekyll creates the required parent directory, e.g.
./tmp/pdf/jekyll/update/2013/11/20
, but then tries to write to./tmp/pdf/jekyll/update/2013/11/20/jekyll/update/2013/11/20/welcome-to-jekyll.pdf
instead of./tmp/pdf/jekyll/update/2013/11/20/welcome-to-jekyll.pdf
, and hence fails.Tested with jekyll 1.3.0 under ruby 2.0.0p247