Add plotly header to template

pull/66/head
Matti Pastell 2016-12-13 15:43:37 +02:00
parent ded6ce2c2a
commit daafd8e911
3 changed files with 20 additions and 4 deletions

View File

@ -0,0 +1,14 @@
<<>>=
using Plots
plotly()
x = linspace(0, 2π, 2056)
@
<<>>=
plot(sinc(x))
@
<<>>=
plot(-sinc(x))
@

View File

@ -22,7 +22,7 @@ function format(doc::WeaveDoc)
formatted = join(formatted, "\n")
# Render using a template if needed
rendered = render_doc(formatted, doc.format)
rendered = render_doc(formatted, doc, doc.format)
return rendered
end
@ -32,11 +32,11 @@ end
Render formatted document to a template
"""
function render_doc(formatted, format)
function render_doc(formatted, doc::WeaveDoc, format)
return formatted
end
function render_doc(formatted, format::JMarkdown2HTML)
function render_doc(formatted, doc::WeaveDoc, format::JMarkdown2HTML)
buf = PipeBuffer()
Highlights.stylesheet(buf, MIME("text/css"))
flush(buf)
@ -47,7 +47,7 @@ function render_doc(formatted, format::JMarkdown2HTML)
template = Mustache.template_from_file(joinpath(dirname(@__FILE__), "../templates/julia_html.txt"))
return Mustache.render(template, themecss = theme_css,
highlightcss = css, body = formatted)
highlightcss = css, body = formatted, header_script = doc.header_script)
end
function format_chunk(chunk::DocChunk, formatdict, docformat)

View File

@ -4,6 +4,8 @@
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
{{{ :header_script }}}
<style type="text/css">
{{{ :themecss }}}
{{{ :highlightcss }}}