Skip to content

Commit

Permalink
use pandoc_jll
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Jun 14, 2020
1 parent 957d12e commit 848d373
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
pandoc_jll = "c5432543-76ad-5c9d-82bf-db097047a5e2"

[compat]
Highlights = "0.3.1, 0.4"
Expand Down
53 changes: 30 additions & 23 deletions src/writer/pandoc.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
using pandoc_jll


function write_doc(docformat::Pandoc2HTML, doc, rendered, out_path)
_, weave_source = splitdir(abspath(doc.source))
weave_version, weave_date = weave_info()
Expand All @@ -20,21 +23,23 @@ function write_doc(docformat::Pandoc2HTML, doc, rendered, out_path)
try
out = basename(out_path)
highlight_stylesheet = get_highlight_stylesheet(MIME("text/html"), docformat.highlight_theme)
cmd = `pandoc -f markdown+raw_html -s --mathjax=""
$filt $citeproc $(docformat.pandoc_options)
--template $(docformat.template_path)
-H $(docformat.stylesheet_path)
$(self_contained)
-V highlight_stylesheet=$(highlight_stylesheet)
-V weave_version=$(weave_version)
-V weave_date=$(weave_date)
-V weave_source=$(weave_source)
-V headerscript=$(header_script)
-o $(out)`
proc = open(cmd, "r+")
println(proc.in, rendered)
close(proc.in)
proc_output = read(proc.out, String)
pandoc() do pandoc_exe
cmd = `$(pandoc_exe) -f markdown+raw_html -s --mathjax=""
$filt $citeproc $(docformat.pandoc_options)
--template $(docformat.template_path)
-H $(docformat.stylesheet_path)
$(self_contained)
-V highlight_stylesheet=$(highlight_stylesheet)
-V weave_version=$(weave_version)
-V weave_date=$(weave_date)
-V weave_source=$(weave_source)
-V headerscript=$(header_script)
-o $(out)`
proc = open(cmd, "r+")
println(proc.in, rendered)
close(proc.in)
read(proc.out, String)
end
catch
rethrow() # TODO: just show error content instead of rethrow the err
finally
Expand All @@ -58,14 +63,16 @@ function write_doc(docformat::Pandoc2PDF, doc, rendered, out_path)
cd(dirname(out_path))
try
out = basename(out_path)
cmd = `pandoc -f markdown+raw_tex -s --pdf-engine=xelatex --highlight-style=tango
$filt $citeproc $(docformat.pandoc_options)
--include-in-header=$(docformat.header_template)
-V fontsize=12pt -o $(out)`
proc = open(cmd, "r+")
println(proc.in, rendered)
close(proc.in)
proc_output = read(proc.out, String)
pandoc() do pandoc_exe
cmd = `$(pandoc_exe) -f markdown+raw_tex -s --pdf-engine=xelatex --highlight-style=tango
$filt $citeproc $(docformat.pandoc_options)
--include-in-header=$(docformat.header_template)
-V fontsize=12pt -o $(out)`
proc = open(cmd, "r+")
println(proc.in, rendered)
close(proc.in)
read(proc.out, String)
end
catch
rethrow()
finally
Expand Down

0 comments on commit 848d373

Please sign in to comment.