mirror of https://github.com/mpastell/Weave.jl
More tests for 0.6
parent
9d4817007e
commit
1915501026
|
@ -4,6 +4,8 @@ author : Matti Pastell
|
||||||
date : 13th December 2016
|
date : 13th December 2016
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# Intro
|
||||||
|
|
||||||
This a sample [Julia](http://julialang.org/) markdown document that can
|
This a sample [Julia](http://julialang.org/) markdown document that can
|
||||||
be executed using [Weave.jl](https://github.com/mpastell/Weave.jl).
|
be executed using [Weave.jl](https://github.com/mpastell/Weave.jl).
|
||||||
|
|
||||||
|
@ -35,7 +37,7 @@ weave(Pkg.dir("Weave","examples","gadfly_md_sample.jmd"), informat="markdown",
|
||||||
The documents will be written to the Julia working directory when you
|
The documents will be written to the Julia working directory when you
|
||||||
use the `out_path = :pwd`.
|
use the `out_path = :pwd`.
|
||||||
|
|
||||||
## Capturing code
|
# Capturing code
|
||||||
|
|
||||||
The basic code chunk will be run with default options and the code and
|
The basic code chunk will be run with default options and the code and
|
||||||
output will be captured.
|
output will be captured.
|
||||||
|
@ -64,7 +66,7 @@ syntax from the source document):
|
||||||
plot(y = cumsum(randn(1000, 1)), Geom.line)
|
plot(y = cumsum(randn(1000, 1)), Geom.line)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Whats next
|
# Whats next
|
||||||
|
|
||||||
Read the documentation:
|
Read the documentation:
|
||||||
|
|
||||||
|
|
|
@ -132,8 +132,8 @@ function format_chunk(chunk::DocChunk, formatdict, docformat::JMarkdown2HTML)
|
||||||
return string(Documenter.Writers.HTMLWriter.mdconvert(m))
|
return string(Documenter.Writers.HTMLWriter.mdconvert(m))
|
||||||
end
|
end
|
||||||
|
|
||||||
if VERSION < v"v0.6.0-362b271"
|
if VERSION < v"v0.6-alpha"
|
||||||
#Fixes to Base latex writer
|
#Fixes to Base latex writer, included in JuliaLang/julia#19842 and JuliaLang/julia#19832.
|
||||||
function Base.Markdown.latex(io::IO, md::Base.Markdown.Paragraph)
|
function Base.Markdown.latex(io::IO, md::Base.Markdown.Paragraph)
|
||||||
println(io)
|
println(io)
|
||||||
for md in md.content
|
for md in md.content
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
~~~~{.julia}
|
||||||
|
using DataFrames
|
||||||
|
df = DataFrame(letters = 'a':'z', numbers = 1:26)
|
||||||
|
|
||||||
|
df
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
~~~~
|
||||||
|
26×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
│ 7 │ 'g' │ 7 │
|
||||||
|
│ 8 │ 'h' │ 8 │
|
||||||
|
⋮
|
||||||
|
│ 18 │ 'r' │ 18 │
|
||||||
|
│ 19 │ 's' │ 19 │
|
||||||
|
│ 20 │ 't' │ 20 │
|
||||||
|
│ 21 │ 'u' │ 21 │
|
||||||
|
│ 22 │ 'v' │ 22 │
|
||||||
|
│ 23 │ 'w' │ 23 │
|
||||||
|
│ 24 │ 'x' │ 24 │
|
||||||
|
│ 25 │ 'y' │ 25 │
|
||||||
|
│ 26 │ 'z' │ 26 │
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
~~~~{.julia}
|
||||||
|
z = 51
|
||||||
|
display(df)
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
~~~~
|
||||||
|
26×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
│ 7 │ 'g' │ 7 │
|
||||||
|
│ 8 │ 'h' │ 8 │
|
||||||
|
⋮
|
||||||
|
│ 18 │ 'r' │ 18 │
|
||||||
|
│ 19 │ 's' │ 19 │
|
||||||
|
│ 20 │ 't' │ 20 │
|
||||||
|
│ 21 │ 'u' │ 21 │
|
||||||
|
│ 22 │ 'v' │ 22 │
|
||||||
|
│ 23 │ 'w' │ 23 │
|
||||||
|
│ 24 │ 'x' │ 24 │
|
||||||
|
│ 25 │ 'y' │ 25 │
|
||||||
|
│ 26 │ 'z' │ 26 │
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
~~~~{.julia}
|
||||||
|
head(df)
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
~~~~
|
||||||
|
6×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
~~~~{.julia}
|
||||||
|
julia> df
|
||||||
|
26×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
│ 7 │ 'g' │ 7 │
|
||||||
|
│ 8 │ 'h' │ 8 │
|
||||||
|
⋮
|
||||||
|
│ 18 │ 'r' │ 18 │
|
||||||
|
│ 19 │ 's' │ 19 │
|
||||||
|
│ 20 │ 't' │ 20 │
|
||||||
|
│ 21 │ 'u' │ 21 │
|
||||||
|
│ 22 │ 'v' │ 22 │
|
||||||
|
│ 23 │ 'w' │ 23 │
|
||||||
|
│ 24 │ 'x' │ 24 │
|
||||||
|
│ 25 │ 'y' │ 25 │
|
||||||
|
│ 26 │ 'z' │ 26 │
|
||||||
|
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
~~~~{.julia}
|
||||||
|
m = Base.Markdown.parse("**Some Markdown**")
|
||||||
|
m
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**Some Markdown**
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
\begin{juliacode}
|
||||||
|
using DataFrames
|
||||||
|
df = DataFrame(letters = 'a':'z', numbers = 1:26)
|
||||||
|
|
||||||
|
df
|
||||||
|
\end{juliacode}
|
||||||
|
\begin{juliaout}
|
||||||
|
26×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
│ 7 │ 'g' │ 7 │
|
||||||
|
│ 8 │ 'h' │ 8 │
|
||||||
|
⋮
|
||||||
|
│ 18 │ 'r' │ 18 │
|
||||||
|
│ 19 │ 's' │ 19 │
|
||||||
|
│ 20 │ 't' │ 20 │
|
||||||
|
│ 21 │ 'u' │ 21 │
|
||||||
|
│ 22 │ 'v' │ 22 │
|
||||||
|
│ 23 │ 'w' │ 23 │
|
||||||
|
│ 24 │ 'x' │ 24 │
|
||||||
|
│ 25 │ 'y' │ 25 │
|
||||||
|
│ 26 │ 'z' │ 26 │
|
||||||
|
\end{juliaout}
|
||||||
|
|
||||||
|
\begin{juliacode}
|
||||||
|
z = 51
|
||||||
|
display(df)
|
||||||
|
\end{juliacode}
|
||||||
|
\begin{juliaout}
|
||||||
|
26×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
│ 7 │ 'g' │ 7 │
|
||||||
|
│ 8 │ 'h' │ 8 │
|
||||||
|
⋮
|
||||||
|
│ 18 │ 'r' │ 18 │
|
||||||
|
│ 19 │ 's' │ 19 │
|
||||||
|
│ 20 │ 't' │ 20 │
|
||||||
|
│ 21 │ 'u' │ 21 │
|
||||||
|
│ 22 │ 'v' │ 22 │
|
||||||
|
│ 23 │ 'w' │ 23 │
|
||||||
|
│ 24 │ 'x' │ 24 │
|
||||||
|
│ 25 │ 'y' │ 25 │
|
||||||
|
│ 26 │ 'z' │ 26 │
|
||||||
|
\end{juliaout}
|
||||||
|
|
||||||
|
\begin{juliacode}
|
||||||
|
head(df)
|
||||||
|
\end{juliacode}
|
||||||
|
\begin{juliaout}
|
||||||
|
6×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
\end{juliaout}
|
||||||
|
|
||||||
|
\begin{juliaterm}
|
||||||
|
julia> df
|
||||||
|
26×2 DataFrames.DataFrame
|
||||||
|
│ Row │ letters │ numbers │
|
||||||
|
├─────┼─────────┼─────────┤
|
||||||
|
│ 1 │ 'a' │ 1 │
|
||||||
|
│ 2 │ 'b' │ 2 │
|
||||||
|
│ 3 │ 'c' │ 3 │
|
||||||
|
│ 4 │ 'd' │ 4 │
|
||||||
|
│ 5 │ 'e' │ 5 │
|
||||||
|
│ 6 │ 'f' │ 6 │
|
||||||
|
│ 7 │ 'g' │ 7 │
|
||||||
|
│ 8 │ 'h' │ 8 │
|
||||||
|
⋮
|
||||||
|
│ 18 │ 'r' │ 18 │
|
||||||
|
│ 19 │ 's' │ 19 │
|
||||||
|
│ 20 │ 't' │ 20 │
|
||||||
|
│ 21 │ 'u' │ 21 │
|
||||||
|
│ 22 │ 'v' │ 22 │
|
||||||
|
│ 23 │ 'w' │ 23 │
|
||||||
|
│ 24 │ 'x' │ 24 │
|
||||||
|
│ 25 │ 'y' │ 25 │
|
||||||
|
│ 26 │ 'z' │ 26 │
|
||||||
|
|
||||||
|
\end{juliaterm}
|
||||||
|
|
||||||
|
\begin{juliacode}
|
||||||
|
m = Base.Markdown.parse("**Some Markdown**")
|
||||||
|
m
|
||||||
|
\end{juliacode}
|
||||||
|
|
||||||
|
\textbf{Some Markdown}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,12 @@ using Weave
|
||||||
using Base.Test
|
using Base.Test
|
||||||
|
|
||||||
function mmtest(source, resfile, doctype)
|
function mmtest(source, resfile, doctype)
|
||||||
|
VER = "$(VERSION.major).$(VERSION.minor)"
|
||||||
weave("documents/$source", out_path = "documents/multimedia/$resfile", doctype=doctype, plotlib=nothing)
|
weave("documents/$source", out_path = "documents/multimedia/$resfile", doctype=doctype, plotlib=nothing)
|
||||||
result = readstring(open("documents/multimedia/$resfile"))
|
result = readstring(open("documents/multimedia/$resfile"))
|
||||||
ref = readstring(open("documents/multimedia/$resfile.ref"))
|
ref = readstring(open("documents/multimedia/$VER/$resfile.ref"))
|
||||||
@test result == ref
|
@test result == ref
|
||||||
|
rm("documents/multimedia/$resfile")
|
||||||
end
|
end
|
||||||
|
|
||||||
mmtest("rich_output.jmd", "rich_output.md", "pandoc")
|
mmtest("rich_output.jmd", "rich_output.md", "pandoc")
|
||||||
|
|
|
@ -11,10 +11,11 @@ include("convert_test.jl")
|
||||||
info("Testing formatters")
|
info("Testing formatters")
|
||||||
include("formatter_test.jl")
|
include("formatter_test.jl")
|
||||||
|
|
||||||
if VERSION < v"0.6-"
|
info("Testing rich output")
|
||||||
info("Testing rich output")
|
include("rich_output.jl")
|
||||||
include("rich_output.jl")
|
|
||||||
|
|
||||||
|
|
||||||
|
if VERSION < v"0.6-"
|
||||||
info("Test: Caching")
|
info("Test: Caching")
|
||||||
include("cache_test.jl")
|
include("cache_test.jl")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue