mirror of https://github.com/mpastell/Weave.jl
Merge 24d7dcfded
into 78befc61b5
commit
c060db73c0
|
@ -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"
|
||||
|
|
|
@ -125,7 +125,7 @@ end
|
|||
# ------
|
||||
|
||||
Base.@kwdef mutable struct Pandoc2HTML <: HTMLFormat
|
||||
description = "HTML via intermediate Pandoc Markdown (requires Pandoc 2)"
|
||||
description = "HTML via intermediate Pandoc Markdown"
|
||||
extension = "md"
|
||||
codestart = "\n"
|
||||
codeend = "\n"
|
||||
|
|
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -2,8 +2,8 @@ using Weave.Dates
|
|||
|
||||
|
||||
test_doctypes = filter(first.(Weave.list_out_formats())) do doctype
|
||||
# don't test doctypes which need external programs
|
||||
doctype ∉ ("pandoc2html", "pandoc2pdf", "md2pdf")
|
||||
# don't test doctypes which need LaTeX to be installed
|
||||
doctype ∉ ("pandoc2pdf", "md2pdf")
|
||||
end
|
||||
|
||||
function test_func(body)
|
||||
|
|
Loading…
Reference in New Issue