mirror of https://github.com/mpastell/Weave.jl
Add test and docs for hold chunk option
parent
1ede33365b
commit
54663179cb
|
@ -26,9 +26,10 @@ weave(Pkg.dir("Weave","examples","gadfly_sample.mdw"))
|
|||
|
||||
## Documentation
|
||||
|
||||
Documenter.jl with MKdDocs generated documentation:
|
||||
Documenter.jl with MKDocs generated documentation:
|
||||
|
||||
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://mpastell.github.io/Weave.jl/stable)
|
||||
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://mpastell.github.io/Weave.jl/latest)
|
||||
|
||||
## Contributing
|
||||
|
||||
|
|
|
@ -405,7 +405,7 @@ function collect_results(chunk::CodeChunk, fmt::CollectResult)
|
|||
result_no = 1
|
||||
for r =chunk.result
|
||||
chunk.output *= r.stdout
|
||||
chunk.figures = [chunk.figures, r.figures]
|
||||
chunk.figures = [chunk.figures; r.figures]
|
||||
end
|
||||
|
||||
return [chunk]
|
||||
|
|
|
@ -34,7 +34,7 @@ ref = readall(open("documents/chunk_options_ref.jl"))
|
|||
@test result == ref
|
||||
cleanup && rm("documents/chunk_options.jl")
|
||||
|
||||
#Test chunk options and output formats
|
||||
#Test functions and sandbox clearing
|
||||
weave("documents/chunk_func.noweb", plotlib=nothing)
|
||||
result = readall(open("documents/chunk_func.md"))
|
||||
ref = readall(open("documents/chunk_func_ref.md"))
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
|
||||
# Default
|
||||
|
||||
<<>>=
|
||||
using Gadfly
|
||||
x = 1:10
|
||||
plot(x = x, y = x)
|
||||
print(x)
|
||||
plot(x = x, y = x)
|
||||
display(x)
|
||||
@
|
||||
|
||||
# Terminal
|
||||
|
||||
<<term=true>>=
|
||||
using Gadfly
|
||||
x = 1:10
|
||||
plot(x = x, y = x)
|
||||
print(x)
|
||||
plot(x = x, y = x)
|
||||
display(x)
|
||||
@
|
||||
|
||||
# Hold results
|
||||
|
||||
<<hold=true>>=
|
||||
using Gadfly
|
||||
x = 1:10
|
||||
plot(x = x, y = x)
|
||||
print(x)
|
||||
plot(x = x, y = x)
|
||||
display(x)
|
||||
@
|
|
@ -0,0 +1,107 @@
|
|||
|
||||
|
||||
# Default
|
||||
|
||||
~~~~{.julia}
|
||||
using Gadfly
|
||||
x = 1:10
|
||||
plot(x = x, y = x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/test_hold_1_1.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
print(x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
1:10
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
plot(x = x, y = x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/test_hold_1_2.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
display(x)
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
1:10
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Terminal
|
||||
|
||||
~~~~{.julia}
|
||||
julia> using Gadfly
|
||||
|
||||
julia> x = 1:10
|
||||
|
||||
1:10
|
||||
julia> plot(x = x, y = x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/test_hold_2_1.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
julia> print(x)
|
||||
1:10
|
||||
julia> plot(x = x, y = x)
|
||||
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/test_hold_2_2.png)\
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
julia> display(x)
|
||||
1:10
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Hold results
|
||||
|
||||
~~~~{.julia}
|
||||
using Gadfly
|
||||
x = 1:10
|
||||
plot(x = x, y = x)
|
||||
print(x)
|
||||
plot(x = x, y = x)
|
||||
display(x)
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
~~~~{.julia}
|
||||
1:10
|
||||
1:10
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
![](figures/test_hold_3_1.png)\
|
||||
|
||||
![](figures/test_hold_3_2.png)\
|
||||
|
|
@ -9,6 +9,9 @@ using Base.Test
|
|||
info("Test: Chunk options")
|
||||
include("chunk_options.jl")
|
||||
|
||||
info("Test: hold and term options with plots")
|
||||
include("test_hold.jl")
|
||||
|
||||
# Cache is currently not implemented for new output format
|
||||
#info("Test: Caching")
|
||||
#include("cache_test.jl")
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
using Weave
|
||||
using Base.Test
|
||||
|
||||
cleanup = true
|
||||
|
||||
#Test hold and term options
|
||||
weave("documents/test_hold.mdw", doctype="pandoc", plotlib="Gadfly")
|
||||
result = readall(open("documents/test_hold.md"))
|
||||
ref = readall(open("documents/test_hold_ref.md"))
|
||||
@test result == ref
|
||||
cleanup && rm("documents/test_hold.md")
|
Loading…
Reference in New Issue