Restore .ps and .js.svg to Gadfly

pull/202/head
Matti Pastell 2019-03-11 15:13:30 +02:00
parent 99db6a9406
commit 95e860816c
5 changed files with 81 additions and 53 deletions

View File

@ -37,7 +37,11 @@ const mimetype_ext =
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".svg" => "image/svg+xml",
".pdf" => "application/pdf")
".js.svg" => "image/svg+xml",
".pdf" => "application/pdf",
".ps" => "application/postscript",
".tex" => "text/latex"
)
function Base.display(report::Report, data)
#Set preferred mimetypes for report based on format

View File

@ -0,0 +1,23 @@
---
options :
out_path : gadfly
---
~~~~{.julia}
using Gadfly
x = range(0, stop =2π, step=0.05)
plot(x=x, y = sin.(x), Geom.line)
~~~~~~~~~~~~~
![sin(x) function.](figures/gadfly_formats_test_sin_fun_1.js.svg){#fig:sin_fun}
![cos(x) function.](figures/gadfly_formats_test_2_1.js.svg)
~~~~{.julia}
plot(x=x, y = cos.(2x), Geom.line)
~~~~~~~~~~~~~
![](figures/gadfly_formats_test_cos2_fun_1.js.svg){width=15cm #fig:cos2_fun}\

View File

@ -0,0 +1,23 @@
\begin{juliacode}
using Gadfly
x = range(0, stop =2π, step=0.05)
plot(x=x, y = sin.(x), Geom.line)
\end{juliacode}
\begin{figure}[ht]
\center
\includegraphics[width=\linewidth]{figures/gadfly_formats_test_sin_fun_1.ps}
\caption{sin(x) function.}
\label{fig:sin_fun}
\end{figure}
\begin{figure}[htpb]
\center
\includegraphics[width=\linewidth]{figures/gadfly_formats_test_2_1.ps}
\caption{cos(x) function.}
\end{figure}
\begin{juliacode}
plot(x=x, y = cos.(2x), Geom.line)
\end{juliacode}
\includegraphics[width=15cm]{figures/gadfly_formats_test_cos2_fun_1.ps}

View File

@ -0,0 +1,23 @@
\begin{juliacode}
using Gadfly
x = range(0, stop =2π, step=0.05)
plot(x=x, y = sin.(x), Geom.line)
\end{juliacode}
\begin{figure}[ht]
\center
\resizebox{\linewidth}{!}{\input{figures/gadfly_formats_test_sin_fun_1.tex}}
\caption{sin(x) function.}
\label{fig:sin_fun}
\end{figure}
\begin{figure}[htpb]
\center
\resizebox{\linewidth}{!}{\input{figures/gadfly_formats_test_2_1.tex}}
\caption{cos(x) function.}
\end{figure}
\begin{juliacode}
plot(x=x, y = cos.(2x), Geom.line)
\end{juliacode}
\resizebox{15cm}{!}{\input{figures/gadfly_formats_test_cos2_fun_1.tex}}

View File

@ -18,58 +18,13 @@ test_gadfly("github", ".png")
test_gadfly("github", ".pdf")
test_gadfly("github", ".svg")
test_gadfly("pandoc", ".png")
test_gadfly("pandoc", ".js.svg")
test_gadfly("tex", ".pdf")
test_gadfly("tex", ".png")
test_gadfly("tex", ".ps")
test_gadfly("tex", ".tex")
##
# weave("documents/gadfly_formats_test.txt", doctype="tex", fig_ext=".tex", plotlib="gadfly")
# result = read("documents/gadfly_formats_test.tex", String)
# ref = read("documents/gadfly_formats_test_tikz_ref.tex", String)
# @test result == ref
#
# weave("documents/gadfly_formats_test.txt", doctype="tex", fig_ext=".ps", plotlib="gadfly")
# result = read("documents/gadfly_formats_test.tex", String)
# ref = read("documents/gadfly_formats_test_ps_ref.tex", String)
# @test result == ref
#
# weave("documents/gadfly_formats_test.txt", doctype="pandoc", plotlib="gadfly")
# result = read("documents/gadfly_formats_test.md", String)
# ref = read("documents/gadfly_formats_test_pandoc_ref.md", String)
# @test result == ref
#
# weave("documents/gadfly_formats_test.txt", doctype="pandoc", plotlib="gadfly", fig_ext=".svg")
# result = read("documents/gadfly_formats_test.md", String)
# ref = read("documents/gadfly_formats_test_svg_ref.md", String)
# @test result == ref
#
# weave("documents/gadfly_formats_test.txt", doctype="github", plotlib="gadfly", fig_ext=".js.svg")
# result = read("documents/gadfly_formats_test.md", String)
# ref = read("documents/gadfly_formats_test_jssvg_ref.md", String)
# @test result == ref
#
# weave("documents/gadfly_formats_test.txt", doctype="rst", plotlib="gadfly")
# result = read("documents/gadfly_formats_test.rst", String)
# ref = read("documents/gadfly_formats_test_ref.rst", String)
# @test result == ref
#
# weave("documents/gadfly_formats_test.txt", doctype="multimarkdown", plotlib="gadfly")
# result = read("documents/gadfly_formats_test.md", String)
# ref = read("documents/gadfly_formats_test_mmd_ref.md", String)
# @test result == ref
#
# weave("documents/gadfly_formats_test.txt", doctype="asciidoc", plotlib="gadfly",
# out_path="documents/output")
# result = read("documents/output/gadfly_formats_test.txt", String)
# ref = read("documents/output/gadfly_formats_test_ref.txt", String)
# @test result == ref
#
# weave("documents/gadfly_markdown_test.jmd", doctype="github",plotlib="gadfly", informat="markdown")
# result = read("documents/gadfly_markdown_test.md", String)
# ref = read("documents/gadfly_markdown_test_ref.md", String)
# @test result == ref
#
# weave("documents/FIR_design.jl", doctype="pandoc", plotlib="gadfly", informat="script")
# result = read("documents/FIR_design.md", String)
# ref = read("documents/FIR_design_ref.md", String)
# @test result == ref
import Gadfly
p = Gadfly.plot(x=1:10, y=1:10)
@test showable(MIME"application/pdf"(), p) == true
@test showable(MIME"application/png"(), p) == true