Skip to content

Commit 848d373

Browse files
committed
use pandoc_jll
1 parent 957d12e commit 848d373

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

Project.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
1515
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
1616
Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1717
YAML = "ddb6d928-2868-570f-bddf-ab3f9cf99eb6"
18+
pandoc_jll = "c5432543-76ad-5c9d-82bf-db097047a5e2"
1819

1920
[compat]
2021
Highlights = "0.3.1, 0.4"

src/writer/pandoc.jl

+30-23
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
using pandoc_jll
2+
3+
14
function write_doc(docformat::Pandoc2HTML, doc, rendered, out_path)
25
_, weave_source = splitdir(abspath(doc.source))
36
weave_version, weave_date = weave_info()
@@ -20,21 +23,23 @@ function write_doc(docformat::Pandoc2HTML, doc, rendered, out_path)
2023
try
2124
out = basename(out_path)
2225
highlight_stylesheet = get_highlight_stylesheet(MIME("text/html"), docformat.highlight_theme)
23-
cmd = `pandoc -f markdown+raw_html -s --mathjax=""
24-
$filt $citeproc $(docformat.pandoc_options)
25-
--template $(docformat.template_path)
26-
-H $(docformat.stylesheet_path)
27-
$(self_contained)
28-
-V highlight_stylesheet=$(highlight_stylesheet)
29-
-V weave_version=$(weave_version)
30-
-V weave_date=$(weave_date)
31-
-V weave_source=$(weave_source)
32-
-V headerscript=$(header_script)
33-
-o $(out)`
34-
proc = open(cmd, "r+")
35-
println(proc.in, rendered)
36-
close(proc.in)
37-
proc_output = read(proc.out, String)
26+
pandoc() do pandoc_exe
27+
cmd = `$(pandoc_exe) -f markdown+raw_html -s --mathjax=""
28+
$filt $citeproc $(docformat.pandoc_options)
29+
--template $(docformat.template_path)
30+
-H $(docformat.stylesheet_path)
31+
$(self_contained)
32+
-V highlight_stylesheet=$(highlight_stylesheet)
33+
-V weave_version=$(weave_version)
34+
-V weave_date=$(weave_date)
35+
-V weave_source=$(weave_source)
36+
-V headerscript=$(header_script)
37+
-o $(out)`
38+
proc = open(cmd, "r+")
39+
println(proc.in, rendered)
40+
close(proc.in)
41+
read(proc.out, String)
42+
end
3843
catch
3944
rethrow() # TODO: just show error content instead of rethrow the err
4045
finally
@@ -58,14 +63,16 @@ function write_doc(docformat::Pandoc2PDF, doc, rendered, out_path)
5863
cd(dirname(out_path))
5964
try
6065
out = basename(out_path)
61-
cmd = `pandoc -f markdown+raw_tex -s --pdf-engine=xelatex --highlight-style=tango
62-
$filt $citeproc $(docformat.pandoc_options)
63-
--include-in-header=$(docformat.header_template)
64-
-V fontsize=12pt -o $(out)`
65-
proc = open(cmd, "r+")
66-
println(proc.in, rendered)
67-
close(proc.in)
68-
proc_output = read(proc.out, String)
66+
pandoc() do pandoc_exe
67+
cmd = `$(pandoc_exe) -f markdown+raw_tex -s --pdf-engine=xelatex --highlight-style=tango
68+
$filt $citeproc $(docformat.pandoc_options)
69+
--include-in-header=$(docformat.header_template)
70+
-V fontsize=12pt -o $(out)`
71+
proc = open(cmd, "r+")
72+
println(proc.in, rendered)
73+
close(proc.in)
74+
read(proc.out, String)
75+
end
6976
catch
7077
rethrow()
7178
finally

0 commit comments

Comments
 (0)