Add citeproc filter to pandoc, fixes #50

pull/86/head
Matti Pastell 2017-03-14 16:08:52 +02:00
parent 38d3b04363
commit 1a54d6a557
1 changed files with 18 additions and 1 deletions

View File

@ -16,7 +16,6 @@ function pandoc2html(formatted::AbstractString, doc::WeaveDoc, outname::Abstract
#Header is inserted from displayed plots
header_script = doc.header_script
#info(doc.header_script)
if header_script ""
self_contained = []
@ -24,6 +23,14 @@ function pandoc2html(formatted::AbstractString, doc::WeaveDoc, outname::Abstract
self_contained = "--self-contained"
end
if haskey(doc.header, "bibliography")
filt = "--filter"
citeproc = "pandoc-citeproc"
else
filt = []
citeproc = []
end
#Change path for pandoc
old_wd = pwd()
cd(doc.cwd)
@ -32,6 +39,7 @@ function pandoc2html(formatted::AbstractString, doc::WeaveDoc, outname::Abstract
try
pandoc_out, pandoc_in, proc = readandwrite(`pandoc -R -s --mathjax="" --highlight-style=tango
$filt $citeproc
--template $html_template -H $css_template $self_contained
-V wversion=$wversion -V wtime=$wtime -V wsource=$wsource
-V headerscript=$header_script
@ -66,9 +74,18 @@ function pandoc2pdf(formatted::AbstractString, doc::WeaveDoc, outname::AbstractS
cd(doc.cwd)
html =""
if haskey(doc.header, "bibliography")
filt = "--filter"
citeproc = "pandoc-citeproc"
else
filt = []
citeproc = []
end
info("Done executing code. Running xelatex")
try
pandoc_out, pandoc_in, proc = readandwrite(`pandoc -R -s --latex-engine=xelatex --highlight-style=tango
$filt $citeproc
--include-in-header=$header_template
-V fontsize=12pt -o $outname`)
println(pandoc_in, formatted)