From 05b55fa8dc185aaa4ef0c94894e8887f0f26421e Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Wed, 26 Sep 2018 17:40:09 +0200 Subject: [PATCH 1/2] honour `html_output_format` in Juno --- src/output.jl | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/output.jl b/src/output.jl index 16494fda..59df4613 100644 --- a/src/output.jl +++ b/src/output.jl @@ -267,9 +267,21 @@ function showjuno(io::IO, m, plt) plt[:thickness_scaling] *= scale prepare_output(plt) - _show(io, m, plt) - - plt[:size] = sz - plt[:dpi] = dpi - plt[:thickness_scaling] = thickness_scaling + try + _showjuno(io, m, plt) + finally + plt[:size] = sz + plt[:dpi] = dpi + plt[:thickness_scaling] = thickness_scaling + end end + +function _showjuno(io::IO, m::MIME"image/svg+xml", plt) + if Symbol(plt.attr[:html_output_format]) ≠ :svg + throw(MethodError(show, (typeof(plt),))) + else + _show(io, m, plt) + end +end + +_showjuno(io::IO, m, plt) = _show(io, m, plt) From ec8084823ce5cc65ae894ebba82a8d1a5f75ab3e Mon Sep 17 00:00:00 2001 From: Sebastian Pfitzner Date: Wed, 26 Sep 2018 17:45:51 +0200 Subject: [PATCH 2/2] slightly nicer method error --- src/output.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output.jl b/src/output.jl index 59df4613..1122ab93 100644 --- a/src/output.jl +++ b/src/output.jl @@ -278,7 +278,7 @@ end function _showjuno(io::IO, m::MIME"image/svg+xml", plt) if Symbol(plt.attr[:html_output_format]) ≠ :svg - throw(MethodError(show, (typeof(plt),))) + throw(MethodError(show, (typeof(m), typeof(plt)))) else _show(io, m, plt) end