mirror of https://github.com/mpastell/Weave.jl
Clean up and fix svg embedding
parent
4bf8e0e209
commit
4a7d63bc7e
|
@ -31,7 +31,7 @@ const default_mime_types = ["image/svg+xml", "image/png", "text/html", "text/pla
|
|||
#From IJulia as a reminder
|
||||
#const supported_mime_types = [ "text/html", "text/latex", "image/svg+xml", "image/png", "image/jpeg", "text/plain", "text/markdown" ]
|
||||
|
||||
const mimetype_from_fig_ext =
|
||||
const mimetype_ext =
|
||||
Dict(".png" => "image/png",
|
||||
".jpg" => "image/jpeg",
|
||||
".jpeg" => "image/jpeg",
|
||||
|
@ -41,7 +41,7 @@ const mimetype_from_fig_ext =
|
|||
function Base.display(report::Report, data)
|
||||
#Set preferred mimetypes for report based on format
|
||||
fig_ext = report.cur_chunk.options[:fig_ext]
|
||||
for m in Iterators.flatten(((mimetype_from_fig_ext[fig_ext], ), report.mimetypes))
|
||||
for m in unique([mimetype_ext[fig_ext] ; report.mimetypes])
|
||||
if showable(m, data)
|
||||
try
|
||||
if !istextmime(m)
|
||||
|
|
|
@ -155,7 +155,7 @@ function img2base64(fig, cwd)
|
|||
if ext == ".png"
|
||||
return "data:image/png;base64," * stringmime(MIME("image/png"), raw)
|
||||
elseif ext == ".svg"
|
||||
return "data:image/svg+xml;base64," * stringmime(MIME("image/svg+xml"), raw)
|
||||
return "data:image/svg+xml;base64," * stringmime(MIME("image/svg"), raw)
|
||||
elseif ext == ".gif"
|
||||
return "data:image/gif;base64," * stringmime(MIME("image/gif"), raw)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue