diff --git a/src/plots.jl b/src/plots.jl index 215c194..ddf4bac 100644 --- a/src/plots.jl +++ b/src/plots.jl @@ -52,7 +52,7 @@ end """Add saved figure name to results and return the name""" -function add_pyplot_figure(report::Report, plot::Plots.Plot, ext) +function add_plots_figure(report::Report, plot::Plots.Plot, ext) chunk = report.cur_chunk full_name, rel_name = get_figname(report, chunk, ext = ext) @@ -62,22 +62,14 @@ function add_pyplot_figure(report::Report, plot::Plots.Plot, ext) return full_name end -function Base.display(report::Report, m::MIME"application/pdf", plot::Plots.Plot{Plots.PyPlotBackend}) - add_pyplot_figure(report, plot, ".pdf") +function Base.display(report::Report, m::MIME"application/pdf", plot::Plots.Plot) + add_plots_figure(report, plot, ".pdf") end -function Base.display(report::Report, m::MIME"image/png", plot::Plots.Plot{Plots.PyPlotBackend}) - add_pyplot_figure(report, plot, ".png") +function Base.display(report::Report, m::MIME"image/png", plot::Plots.Plot) + add_plots_figure(report, plot, ".png") end -function Base.display(report::Report, m::MIME"image/svg+xml", plot::Plots.Plot{Plots.PyPlotBackend}) - add_pyplot_figure(report, plot, ".svg") -end - -function Base.display(report::Report, m::MIME"image/svg+xml", plot::Plots.Plot{Plots.PGFPlotsBackend}) - add_pyplot_figure(report, plot, ".png") -end - -function Base.display(report::Report, m::MIME"application/pdf", plot::Plots.Plot{Plots.PGFPlotsBackend}) - add_pyplot_figure(report, plot, ".pdf") +function Base.display(report::Report, m::MIME"image/svg+xml", plot::Plots.Plot) + add_plots_figure(report, plot, ".svg") end diff --git a/test/documents/publish/publish_tex.tex.ref b/test/documents/publish/publish_tex.tex.ref index 046da2a..528343a 100644 --- a/test/documents/publish/publish_tex.tex.ref +++ b/test/documents/publish/publish_tex.tex.ref @@ -8,7 +8,7 @@ \end{lstlisting} -\includegraphics{figures/publish_test_1_1.png} +\includegraphics{figures/publish_test_1_1.pdf} \begin{lstlisting} @@ -18,7 +18,7 @@ \begin{figure}[!h] \center -\includegraphics{figures/publish_test_somefig_1.png} +\includegraphics{figures/publish_test_somefig_1.pdf} \caption{Hello} \label{fig:somefig} \end{figure} diff --git a/test/publish_test.jl b/test/publish_test.jl index bc63c81..1e49ca9 100644 --- a/test/publish_test.jl +++ b/test/publish_test.jl @@ -7,8 +7,8 @@ function publish_test(outfile, format) weave(infile, doctype = format, out_path = outfile, template = "templates/mini.tpl") result = readstring(open(outfile)) ref = readstring(open(outfile * ".ref")) - rm(outfile) @test result == ref + rm(outfile) end #Test formatters