Skip to content

Commit

Permalink
undo regression in pre-2.0 pandoc support
Browse files Browse the repository at this point in the history
fixes #146
  • Loading branch information
tlnagy committed Sep 20, 2018
1 parent bf57bf8 commit 1b7fcad
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pandoc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ function pandoc2pdf(formatted::AbstractString, doc::WeaveDoc, outname::AbstractS

@info("Done executing code. Running xelatex")
try
cmd = `pandoc -f markdown+raw_tex -s --pdf-engine=xelatex --highlight-style=tango
engine_cmd = get_pandoc_version() > "2.0.0.0" ? "--pdf-engine" : "--latex-engine"
cmd = `pandoc -f markdown+raw_tex -s $engine_cmd=xelatex --highlight-style=tango
$filt $citeproc $pandoc_options
--include-in-header=$header_template
-V fontsize=12pt -o $outname`
Expand Down Expand Up @@ -124,3 +125,12 @@ function run_latex(doc::WeaveDoc, outname, latex_cmd = "xelatex")
return false
end
end

"""
`get_pandoc_version()`
Returns a string containing pandoc's version number
"""
function get_pandoc_version()
match(r"pandoc (?<version>[\d.]+)\n", read(`pandoc --version`, String))["version"]
end

0 comments on commit 1b7fcad

Please sign in to comment.