diff --git a/doc/src/publish.md b/doc/src/publish.md index fae58cf..d82f120 100644 --- a/doc/src/publish.md +++ b/doc/src/publish.md @@ -41,8 +41,8 @@ e.g.: `weave("FIR_design_plots.jl", template = "custom.tpl"`. As starting point, you can use the existing templates: -- HTML (`md2html`): [julia_html.tpl](https://github.com/mpastell/Weave.jl/blob/master/templates/julia_html.tpl) -- LaTex (`md2pdf`): [julia_tex.tpl](https://github.com/mpastell/Weave.jl/blob/master/templates/julia_tex.tpl) +- HTML (`md2html`): [`md2html.tpl`](https://github.com/mpastell/Weave.jl/blob/master/templates/md2html.tpl) +- LaTex (`md2pdf`): [`md2pdf.tpl`](https://github.com/mpastell/Weave.jl/blob/master/templates/md2pdf.tpl) Templates are rendered using [Mustache.jl](https://github.com/jverzani/Mustache.jl). diff --git a/src/Weave.jl b/src/Weave.jl index a922eaf..39871f0 100644 --- a/src/Weave.jl +++ b/src/Weave.jl @@ -5,6 +5,7 @@ using Highlights, Mustache, Requires const PKG_DIR = normpath(@__DIR__, "..") const TEMPLATE_DIR = normpath(PKG_DIR, "templates") +const STYLESHEET_DIR = normpath(PKG_DIR, "stylesheets") const WEAVE_OPTION_NAME = "weave_options" const WEAVE_OPTION_NAME_DEPRECATED = "options" # remove this when tagging v0.11 const WEAVE_OPTION_DEPRECATE_ID = "weave_option_duplicate_id" diff --git a/src/format.jl b/src/format.jl index fbb7822..86ea71e 100644 --- a/src/format.jl +++ b/src/format.jl @@ -57,11 +57,11 @@ get_highlight_theme(::Nothing) = Highlights.Themes.DefaultTheme get_highlight_theme(highlight_theme::Type{<:Highlights.AbstractTheme}) = highlight_theme get_template(::Nothing, tex::Bool = false) = - Mustache.template_from_file(normpath(TEMPLATE_DIR, tex ? "julia_tex.tpl" : "julia_html.tpl")) + Mustache.template_from_file(normpath(TEMPLATE_DIR, tex ? "md2pdf.tpl" : "md2html.tpl")) get_template(path::AbstractString, tex) = Mustache.template_from_file(path) get_template(tpl::Mustache.MustacheTokens, tex) = tpl -get_stylesheet(::Nothing) = get_stylesheet(normpath(TEMPLATE_DIR, "skeleton_css.css")) +get_stylesheet(::Nothing) = get_stylesheet(normpath(STYLESHEET_DIR, "skeleton.css")) get_stylesheet(path::AbstractString) = read(path, String) get_highlight_stylesheet(mime, highlight_theme) = diff --git a/src/pandoc.jl b/src/pandoc.jl index 6f82f5e..8a84638 100644 --- a/src/pandoc.jl +++ b/src/pandoc.jl @@ -1,6 +1,6 @@ function pandoc2html(rendered, doc, highlight_theme, outname, pandoc_options) - template_path = normpath(PKG_DIR, "templates/pandoc_skeleton.html") - stylesheet_path = normpath(PKG_DIR, "templates/pandoc_skeleton.css") + template_path = normpath(TEMPLATE_DIR, "pandoc2html.html") + stylesheet_path = normpath(STYLESHEET_DIR, "pandoc2html_skeleton.css") highlight_stylesheet = get_highlight_stylesheet(MIME("text/html"), highlight_theme) _, weave_source = splitdir(abspath(doc.source)) @@ -48,8 +48,7 @@ function pandoc2html(rendered, doc, highlight_theme, outname, pandoc_options) end function pandoc2pdf(rendered, doc, outname, pandoc_options) - weavedir = dirname(@__FILE__) - header_template = joinpath(weavedir, "../templates/pandoc_header.txt") + header_template = normpath(TEMPLATE_DIR, "pandoc2pdf_header.txt") outname = basename(outname) diff --git a/templates/pandoc_skeleton.css b/stylesheets/pandoc2html_skeleton.css similarity index 100% rename from templates/pandoc_skeleton.css rename to stylesheets/pandoc2html_skeleton.css diff --git a/templates/skeleton_css.css b/stylesheets/skeleton.css similarity index 100% rename from templates/skeleton_css.css rename to stylesheets/skeleton.css diff --git a/templates/julia_html.tpl b/templates/md2html.tpl similarity index 100% rename from templates/julia_html.tpl rename to templates/md2html.tpl diff --git a/templates/julia_tex.tpl b/templates/md2pdf.tpl similarity index 100% rename from templates/julia_tex.tpl rename to templates/md2pdf.tpl diff --git a/templates/pandoc_skeleton.html b/templates/pandoc2html.html similarity index 100% rename from templates/pandoc_skeleton.html rename to templates/pandoc2html.html diff --git a/templates/pandoc_header.txt b/templates/pandoc2pdf_header.txt similarity index 100% rename from templates/pandoc_header.txt rename to templates/pandoc2pdf_header.txt