mirror of https://github.com/mpastell/Weave.jl
Allow custom fields in templates, closes #100
parent
4cd0b92792
commit
341edd3784
|
@ -59,7 +59,6 @@ end
|
||||||
|
|
||||||
function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2HTML)
|
function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2HTML)
|
||||||
css = stylesheet(MIME("text/html"), doc.highlight_theme)
|
css = stylesheet(MIME("text/html"), doc.highlight_theme)
|
||||||
title, author, date = get_titleblock(doc)
|
|
||||||
path, wsource = splitdir(abspath(doc.source))
|
path, wsource = splitdir(abspath(doc.source))
|
||||||
#wversion = string(Pkg.installed("Weave"))
|
#wversion = string(Pkg.installed("Weave"))
|
||||||
wversion = ""
|
wversion = ""
|
||||||
|
@ -77,17 +76,14 @@ function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2HTML)
|
||||||
template = Mustache.template_from_file(doc.template)
|
template = Mustache.template_from_file(doc.template)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Mustache.render(template, themecss = theme_css,
|
return Mustache.render(template; themecss = theme_css,
|
||||||
highlightcss = css, body = formatted, header_script = doc.header_script,
|
highlightcss = css, body = formatted, header_script = doc.header_script,
|
||||||
source = wsource, wtime = wtime, wversion = wversion,
|
source = wsource, wtime = wtime, wversion = wversion,
|
||||||
title = title, author = author, date = date)
|
[Pair(Symbol(k), v) for (k,v) in doc.header]...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2tex)
|
function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2tex)
|
||||||
highlight = stylesheet(MIME("text/latex"), doc.highlight_theme)
|
highlight = stylesheet(MIME("text/latex"), doc.highlight_theme)
|
||||||
|
|
||||||
title, author, date = get_titleblock(doc)
|
|
||||||
|
|
||||||
path, wsource = splitdir(abspath(doc.source))
|
path, wsource = splitdir(abspath(doc.source))
|
||||||
#wversion = string(Pkg.installed("Weave"))
|
#wversion = string(Pkg.installed("Weave"))
|
||||||
wversion = ""
|
wversion = ""
|
||||||
|
@ -100,16 +96,9 @@ function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2tex)
|
||||||
template = Mustache.template_from_file(doc.template)
|
template = Mustache.template_from_file(doc.template)
|
||||||
end
|
end
|
||||||
|
|
||||||
return Mustache.render(template, body = formatted,
|
return Mustache.render(template; body = formatted,
|
||||||
highlight = highlight,
|
highlight = highlight,
|
||||||
title = title, author = author, date = date)
|
[Pair(Symbol(k), v) for (k,v) in doc.header]...)
|
||||||
end
|
|
||||||
|
|
||||||
function get_titleblock(doc::WeaveDoc)
|
|
||||||
title = get!(doc.header, "title", false)
|
|
||||||
author = get!(doc.header, "author", false)
|
|
||||||
date = get!(doc.header, "date", false)
|
|
||||||
return title, author, date
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function strip_header(chunk::DocChunk)
|
function strip_header(chunk::DocChunk)
|
||||||
|
|
Loading…
Reference in New Issue