diff --git a/src/Weave.jl b/src/Weave.jl index c68e0fe..aa26a77 100644 --- a/src/Weave.jl +++ b/src/Weave.jl @@ -194,7 +194,7 @@ function weave( keep_unicode = get(weave_options, "keep_unicode", keep_unicode) end - set_rendering_options!(doc; template = template, highlight_theme = highlight_theme, css = css, keep_unicode = keep_unicode) + set_format_options!(doc; template = template, highlight_theme = highlight_theme, css = css, keep_unicode = keep_unicode) rendered = render_doc(doc) out_path = get_out_path(doc, out_path) diff --git a/src/rendering/common.jl b/src/rendering/common.jl index 49bb813..1e9145e 100644 --- a/src/rendering/common.jl +++ b/src/rendering/common.jl @@ -3,7 +3,7 @@ # fallback methods # ---------------- -set_rendering_options!(docformat::WeaveFormat; kwargs...) = return +set_format_options!(docformat::WeaveFormat; _kwargs...) = return function restore_header!(doc) (hasproperty(doc.format, :preserve_header) && doc.format.preserve_header) || return @@ -149,8 +149,8 @@ end addlines(op, inline) = inline.ctype === :line ? string('\n', op, '\n') : op -get_template(path::AbstractString) = Mustache.template_from_file(path) -get_template(tpl::Mustache.MustacheTokens) = tpl +get_mustache_template(path::AbstractString) = Mustache.template_from_file(path) +get_mustache_template(tpl::Mustache.MustacheTokens) = tpl get_highlight_stylesheet(mime, highlight_theme) = get_highlight_stylesheet(mime, get_highlight_theme(highlight_theme)) diff --git a/src/rendering/htmlformats.jl b/src/rendering/htmlformats.jl index e5f9949..7124118 100644 --- a/src/rendering/htmlformats.jl +++ b/src/rendering/htmlformats.jl @@ -35,14 +35,14 @@ Base.@kwdef mutable struct JMarkdown2HTML <: HTMLFormat end register_format!("md2html", JMarkdown2HTML()) -function set_rendering_options!(docformat::JMarkdown2HTML; template = nothing, css = nothing, highlight_theme = nothing, kwargs...) +function set_format_options!(docformat::JMarkdown2HTML; template = nothing, css = nothing, highlight_theme = nothing, _kwargs...) docformat.template = get_html_template(template) docformat.stylesheet = get_stylesheet(css) docformat.highlight_theme = get_highlight_theme(highlight_theme) end -get_html_template(::Nothing) = get_template(normpath(TEMPLATE_DIR, "md2html.tpl")) -get_html_template(x) = get_template(x) +get_html_template(::Nothing) = get_mustache_template(normpath(TEMPLATE_DIR, "md2html.tpl")) +get_html_template(x) = get_mustache_template(x) get_stylesheet(::Nothing) = get_stylesheet(normpath(STYLESHEET_DIR, "skeleton.css")) get_stylesheet(path::AbstractString) = read(path, String) diff --git a/src/rendering/rendering.jl b/src/rendering/rendering.jl index 92e99ac..d30dabf 100644 --- a/src/rendering/rendering.jl +++ b/src/rendering/rendering.jl @@ -13,7 +13,7 @@ const FORMATS = Dict{String,WeaveFormat}() register_format!(format_name::AbstractString, format::WeaveFormat) = push!(FORMATS, format_name => format) register_format!(_, format) = error("Format needs to be a subtype of WeaveFormat.") -set_rendering_options!(doc; kwargs...) = set_rendering_options!(doc.format; kwargs...) +set_format_options!(doc; kwargs...) = set_format_options!(doc.format; kwargs...) function render_doc(doc::WeaveDoc) restore_header!(doc) diff --git a/src/rendering/texformats.jl b/src/rendering/texformats.jl index cdb3874..c3ff389 100644 --- a/src/rendering/texformats.jl +++ b/src/rendering/texformats.jl @@ -3,13 +3,13 @@ abstract type TexFormat <: WeaveFormat end -function set_rendering_options!(docformat::TexFormat; keep_unicode = false, template=nothing, kwargs...) +function set_format_options!(docformat::TexFormat; keep_unicode = false, template=nothing, _kwargs...) docformat.keep_unicode |= keep_unicode docformat.template = get_tex_template(template) end -get_tex_template(::Nothing) = get_template(normpath(TEMPLATE_DIR, "md2pdf.tpl")) -get_tex_template(x) = get_template(x) +get_tex_template(::Nothing) = get_mustache_template(normpath(TEMPLATE_DIR, "md2pdf.tpl")) +get_tex_template(x) = get_mustache_template(x) # very similar to export to html function format_chunk(chunk::DocChunk, docformat::TexFormat) @@ -203,7 +203,7 @@ end register_format!("md2tex", JMarkdown2PDF()) register_format!("md2pdf", JMarkdown2PDF()) -function set_rendering_options!(docformat::JMarkdown2PDF; template = nothing, highlight_theme = nothing, keep_unicode = false, kwargs...) +function set_format_options!(docformat::JMarkdown2PDF; template = nothing, highlight_theme = nothing, keep_unicode = false, _kwargs...) docformat.template = get_tex_template(template) docformat.highlight_theme = get_highlight_theme(highlight_theme) docformat.keep_unicode |= keep_unicode diff --git a/test/render/texformats.jl b/test/render/texformats.jl index 17dbdf0..99bde49 100644 --- a/test/render/texformats.jl +++ b/test/render/texformats.jl @@ -16,13 +16,13 @@ ``` """ doc = mock_run(str; doctype = "md2tex") - Weave.set_rendering_options!(doc.format) + Weave.set_format_options!(doc.format) rendered = Weave.render_doc(doc) @test occursin("alpha", rendered) @test !occursin("α", rendered) doc = mock_run(str; doctype = "md2tex") - Weave.set_rendering_options!(doc.format; keep_unicode = true) + Weave.set_format_options!(doc.format; keep_unicode = true) rendered = Weave.render_doc(doc) @test !occursin("alpha", rendered) @test occursin("α", rendered)