Fixes Winston support, some tests now work on 0.5

pull/35/head
Matti Pastell 2016-04-20 20:23:00 +03:00
parent 589e0aaf61
commit f62a315dc0
13 changed files with 78 additions and 219 deletions

View File

@ -3,12 +3,13 @@
### In master
* Change pandoc output to use inline images if there is no caption
* Use Documenter.jl for documentation
* Change pandoc output to use inline images if there is no caption.
* Use Documenter.jl for documentation.
* Add chunk option `hold`, replaces results = "hold". This way you can use e.g. `hold = true, results=raw`.
* Methods for setting and restoring default chunk options for documents.
* New output options `md2pdf` and `md2html`, both use pandoc to output pdf and
html files directly with own templates.
* New output options `md2pdf` and `md2html`, both use pandoc to output pdf
and html files directly with own templates.
* Restored and improved Winston support.
### v0.1.0

View File

@ -12,7 +12,7 @@ You can write your documentation and code in input document using Nowed or Markd
* Noweb or markdown syntax for input documents.
* Execute code as terminal or "script" chunks.
* Capture PyPlot, Gadfly figures. (or Winston in 0.0.4)
* Capture Gadfly, PyPlot and Winston figures.
* Supports LaTex, Pandoc and Github markdown and reStructuredText output
## Usage

View File

@ -10,9 +10,8 @@ and Sweave.
* Noweb or markdown syntax for input documents.
* Execute code as terminal or "script" chunks.
* Capture PyPlot or Gadfly figures.
* Supports LaTex, Pandoc and Github markdown and reStructuredText output
* Capture Gadfly, PyPlot or Winston figures.
* Supports LaTex, Pandoc and Github markdown, AsciiDoc and reStructuredText output
## Contents
@ -141,9 +140,6 @@ Weave currently supports the following chunk options with the following defaults
* `fig_env="figure"`. Figure environment in Latex.
## Set default chunk options
You can set or alter the default chunk options for a document either before

View File

@ -17,7 +17,7 @@ weave(Pkg.dir("Weave","examples","winston_sample.mdw"), plotlib="Winston")
<<term=true>>=
x = 1:10
d = {"Weave" => "testing"}
d = Dict("Weave" => "testing")
y = [2, 4 ,8]
@

View File

@ -29,7 +29,7 @@ function Base.display(doc::Report, data)
for m in supported_mime_types
if mimewritable(m(), data)
display(doc, m(), data)
brea
break
end
end
end

View File

@ -4,26 +4,12 @@ Gadfly.set_default_plot_format(:png)
#Captures figures
function Base.display(report::Report, m::MIME"image/png", p::Plot)
chunk = report.cur_chunk
chunk = report.cur_chunk
full_name, rel_name = get_figname(report, chunk)
docformat = formats[report.formatdict[:doctype]]
#Add to results for term chunks and store otherwise
#if chunk.options[:term]
# chunk.figures = [rel_name]
#if report.term_state == :text
# report.cur_result *= "\n" * report.formatdict[:codeend] * "\n"
#end
#report.cur_result *= formatfigures(chunk, docformat)
#report.term_state = :fig
# chunk.figures = AbstractString[]
#else
push!(report.figures, rel_name)
#end
push!(report.figures, rel_name)
report.fignum += 1

View File

@ -7,8 +7,8 @@ function Base.display(report::Report, m::MIME"image/png", data)
docformat = formats[report.formatdict[:doctype]]
push!(report.figures, rel_name)
vector_fmts = [".pdf", ".svg"]
report.fignum += 1
vector_fmts = [".pdf"; ".svg"]
#Don't use dpi for vector formats
if chunk.options[:fig_ext] in vector_fmts
@ -19,6 +19,4 @@ function Base.display(report::Report, m::MIME"image/png", data)
width=chunk.options[:fig_width]*chunk.options[:dpi],
height=chunk.options[:fig_height]*chunk.options[:dpi])
end
report.fignum += 1
end

View File

@ -2,3 +2,4 @@ julia 0.4
Cairo
Gadfly
PyPlot
Winston

View File

@ -1,31 +1,10 @@
````julia
julia> using Winston
julia> t = linspace(0, 2*pi, 100)
100-element Array{Float64,1}:
0.0
0.0634665
0.126933
0.1904
0.253866
0.317333
0.380799
0.444266
0.507732
0.571199
5.77545
5.83892
5.90239
5.96585
6.02932
6.09279
6.15625
6.21972
6.28319
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
````
@ -33,33 +12,16 @@ julia> plot(t, sinc(t))
![](figures/winston_formats_1_1.png)
````julia
FramedPlot(...)
````
````julia
julia> s = 1:10
1:10
julia> plot(s, "r*")
````
![](figures/winston_formats_1_2.png)
````julia
FramedPlot(...)
````
@ -84,6 +46,13 @@ add(p, Curve(x, c, color="red"))
add(p, Curve(x, s, color="blue"))
display(p)
````
![](figures/winston_formats_3_1.png)
````julia
p = FramedPlot(
aspect_ratio=1,
xrange=(0,100),
@ -111,5 +80,4 @@ display(p)
````
![](figures/winston_formats_3_1.png)
![](figures/winston_formats_3_2.png)

View File

@ -1,33 +1,12 @@
.. code-block:: julia
julia> using Winston
julia> t = linspace(0, 2*pi, 100)
100-element Array{Float64,1}:
0.0
0.0634665
0.126933
0.1904
0.253866
0.317333
0.380799
0.444266
0.507732
0.571199
5.77545
5.83892
5.90239
5.96585
6.02932
6.09279
6.15625
6.21972
6.28319
julia> plot(t, sinc(t))
julia> using Winston
julia> t = linspace(0, 2*pi, 100)
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
@ -38,20 +17,10 @@
.. code-block:: julia
FramedPlot(...)
.. code-block:: julia
julia> s = 1:10
1:10
julia> plot(s, "r*")
julia> s = 1:10
1:10
julia> plot(s, "r*")
@ -59,15 +28,6 @@
:width: 15 cm
.. code-block:: julia
FramedPlot(...)
@ -97,6 +57,16 @@
add(p, Curve(x, s, color="blue"))
display(p)
.. image:: figures/winston_formats_3_1.png
:width: 15 cm
.. code-block:: julia
p = FramedPlot(
aspect_ratio=1,
xrange=(0,100),
@ -124,9 +94,6 @@
.. image:: figures/winston_formats_3_1.png
:width: 15 cm
.. image:: figures/winston_formats_3_2.png
:width: 15 cm

View File

@ -1,57 +1,23 @@
\begin{juliaterm}
julia> using Winston
julia> t = linspace(0, 2*pi, 100)
100-element Array{Float64,1}:
0.0
0.0634665
0.126933
0.1904
0.253866
0.317333
0.380799
0.444266
0.507732
0.571199
5.77545
5.83892
5.90239
5.96585
6.02932
6.09279
6.15625
6.21972
6.28319
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
\end{juliacode}
\end{juliaterm}
\includegraphics[width=\linewidth]{figures/winston_formats_1_1.pdf}
\begin{juliacode}
FramedPlot(...)
\end{juliacode}
\begin{juliacode}
\begin{juliaterm}
julia> s = 1:10
1:10
julia> plot(s, "r*")
\end{juliacode}
\end{juliaterm}
\includegraphics[width=\linewidth]{figures/winston_formats_1_2.pdf}
\begin{juliacode}
FramedPlot(...)
\end{juliacode}
@ -81,6 +47,11 @@ add(p, Curve(x, c, color="red"))
add(p, Curve(x, s, color="blue"))
display(p)
\end{juliacode}
\includegraphics[width=\linewidth]{figures/winston_formats_3_1.pdf}
\begin{juliacode}
p = FramedPlot(
aspect_ratio=1,
xrange=(0,100),
@ -106,5 +77,4 @@ l = Legend(.1, .9, {a,b,s})
add(p, s, a, b, l)
display(p)
\end{juliacode}
\includegraphics[width=\linewidth]{figures/winston_formats_3_1.pdf}
\includegraphics[width=\linewidth]{figures/winston_formats_3_2.pdf}

View File

@ -1,63 +1,27 @@
~~~~{.julia}
julia> using Winston
julia> t = linspace(0, 2*pi, 100)
100-element Array{Float64,1}:
0.0
0.0634665
0.126933
0.1904
0.253866
0.317333
0.380799
0.444266
0.507732
0.571199
5.77545
5.83892
5.90239
5.96585
6.02932
6.09279
6.15625
6.21972
6.28319
linspace(0.0,6.283185307179587,100)
julia> plot(t, sinc(t))
~~~~~~~~~~~~~
![](figures/winston_formats_1_1.svg)
~~~~{.julia}
FramedPlot(...)
~~~~~~~~~~~~~
![](figures/winston_formats_1_1.svg)\
~~~~{.julia}
julia> s = 1:10
1:10
julia> plot(s, "r*")
~~~~~~~~~~~~~
![](figures/winston_formats_1_2.svg)
~~~~{.julia}
FramedPlot(...)
~~~~~~~~~~~~~
![](figures/winston_formats_1_2.svg)\
@ -84,6 +48,14 @@ add(p, Curve(x, c, color="red"))
add(p, Curve(x, s, color="blue"))
display(p)
~~~~~~~~~~~~~
![](figures/winston_formats_3_1.svg)\
~~~~{.julia}
p = FramedPlot(
aspect_ratio=1,
xrange=(0,100),
@ -111,5 +83,5 @@ display(p)
~~~~~~~~~~~~~
![](figures/winston_formats_3_1.svg)
![](figures/winston_formats_3_2.svg)
![](figures/winston_formats_3_2.svg)\

View File

@ -9,20 +9,20 @@ using Base.Test
info("Test: Chunk options")
include("chunk_options.jl")
info("Test: Chunk options with Gadfly")
include("chunk_opts_gadfly.jl")
# Cache is currently not implemented for new output format
#info("Test: Caching")
#include("cache_test.jl")
# Winston support not updated for 0.4
# info("Test: Weaving with Winston")
# include("winston_formats.jl")
if VERSION < v"0.5-dev"
info("Test: Chunk options with Gadfly")
include("chunk_opts_gadfly.jl")
info("Test: Weaving with Winston")
include("winston_formats.jl")
info("Test: Weaving with Gadfly")
include("gadfly_formats.jl")
info("Test: Weaving with Gadfly")
include("gadfly_formats.jl")
info("Test: Weaving with PyPlot")
include("pyplot_formats.jl")
info("Test: Weaving with PyPlot")
include("pyplot_formats.jl")
end