Clean up and fix svg embedding

pull/172/head
Matti Pastell 2019-02-08 16:01:25 +02:00
parent 4bf8e0e209
commit 4a7d63bc7e
2 changed files with 3 additions and 3 deletions

View File

@ -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)

View File

@ -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