JunoLab / Weave.jl

Scientific reports/literate programming for Julia
http://weavejl.mpastell.com
MIT License
831 stars 96 forks source link

Support for pandoc versions <2.0 on Julia 1.0? #146

Open tlnagy opened 6 years ago

tlnagy commented 6 years ago

The latest version of pandoc on Ubuntu 18.04 LTS is pandoc 1.19.2.4 and PDF generation fails on Julia 1.0 with Weave 0.6.2 because pandoc 1.19 still has --latex-engine as the option instead of --pdf-engine. Any chance that this can be supported as a backup?

julia> using Weave

julia> weave("analysis.jmd", doctype="pandoc2pdf")
[ Info: Weaving chunk 1 from line 5
[ Info: Done executing code. Running xelatex
pandoc: unrecognized option `--pdf-engine=xelatex'
Try pandoc --help for more information.
┌ Warning: Error converting document to pdf
└ @ Weave ~/.julia/packages/Weave/1O5IK/src/pandoc.jl:102
ERROR: IOError: write: broken pipe (EPIPE)
Stacktrace:
 [1] macro expansion at ./logging.jl:318 [inlined]
 [2] pandoc2pdf(::String, ::Weave.WeaveDoc, ::String, ::Array{String,1}) at /home/tamas/.julia/packages/Weave/1O5IK/src/pandoc.jl:89

Interestingly, this code runs on Julia 0.6.x with Weave 0.5.2

julia> weave("analysis.jmd", doctype="pandoc2pdf")
INFO: Weaving chunk 1 from line 5
INFO: Done executing code. Running xelatex
INFO: Report weaved to analysis.pdf
tlnagy commented 6 years ago

It looks like this was changed in https://github.com/mpastell/Weave.jl/commit/4cd0b92792e219cb77a42d1a74000234f00b5880. I think a workable solution would be to attempt to use --pdf-engine first and if that fails use --latex-engine as an option. There are lots of systems that are still using pandoc <2.0 out there so it would be shame to drop support for all of them due to a small flag change.