mirror of https://github.com/mpastell/Weave.jl
Improved markdown reader
parent
29d15b00b7
commit
85bfafb760
|
@ -4,6 +4,9 @@ examples/figures/
|
||||||
examples/*.md
|
examples/*.md
|
||||||
examples/*.pdf
|
examples/*.pdf
|
||||||
examples/*.html
|
examples/*.html
|
||||||
|
examples/*.rst
|
||||||
|
examples/*.tex
|
||||||
|
|
||||||
tmp/
|
tmp/
|
||||||
.idea
|
.idea
|
||||||
*.*~
|
*.*~
|
||||||
|
|
|
@ -68,7 +68,8 @@ weave(Pkg.dir("JuliaReport","examples","gadfly_sample.mdw"), plotlib="Gadfly")
|
||||||
The signature of weave functions is:
|
The signature of weave functions is:
|
||||||
|
|
||||||
````julia
|
````julia
|
||||||
function weave(source ; doctype = "pandoc", plotlib="PyPlot", informat="noweb", fig_path = "figures", fig_ext = nothing)
|
function weave(source ; doctype = "pandoc",
|
||||||
|
plotlib="PyPlot", informat="noweb", fig_path = "figures", fig_ext = nothing)
|
||||||
````
|
````
|
||||||
|
|
||||||
**Note:** Run JuliaReport from terminal and not using IJulia, Juno or ESS, they tend to mess with capturing output.
|
**Note:** Run JuliaReport from terminal and not using IJulia, Juno or ESS, they tend to mess with capturing output.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
# Gadfly
|
# Gadfly
|
||||||
|
|
||||||
```{julia term=true; fig_width=5}
|
```{julia;term=true;fig_width=5}
|
||||||
using Gadfly
|
using Gadfly
|
||||||
x = linspace(0, 2π, 200)
|
x = linspace(0, 2π, 200)
|
||||||
plot(x=x, y = sin(x), Geom.line)
|
plot(x=x, y = sin(x), Geom.line)
|
||||||
|
@ -10,7 +10,21 @@ plot(x=x, y = cos(x), Geom.line)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
```{julia}
|
```julia
|
||||||
x = linspace(0, 200)
|
x = linspace(0, 200)
|
||||||
println(x)
|
println(x)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
~~~{julia;term=true;fig_width=5}
|
||||||
|
using Gadfly
|
||||||
|
x = linspace(0, 2π, 200)
|
||||||
|
plot(x=x, y = sin(x), Geom.line)
|
||||||
|
y = 20
|
||||||
|
plot(x=x, y = cos(x), Geom.line)
|
||||||
|
~~~
|
||||||
|
|
||||||
|
~~~julia
|
||||||
|
x = linspace(0, 200)
|
||||||
|
println(x)
|
||||||
|
~~~
|
||||||
|
|
|
@ -4,11 +4,11 @@ pushopt(options::Dict,expr::Expr) = Base.Meta.isexpr(expr,:(=)) && (options[expr
|
||||||
const input_formats = @compat Dict{String, Any}(
|
const input_formats = @compat Dict{String, Any}(
|
||||||
"noweb" => Dict{Symbol, Any}(
|
"noweb" => Dict{Symbol, Any}(
|
||||||
:codestart => r"^<<(.*?)>>=\s*$",
|
:codestart => r"^<<(.*?)>>=\s*$",
|
||||||
:codeend => r"^@(\s*)$"
|
:codeend => r"^@\s*$"
|
||||||
),
|
),
|
||||||
"markdown" => Dict{Symbol, Any}(
|
"markdown" => Dict{Symbol, Any}(
|
||||||
:codestart => r"^```{julia(.*)}",
|
:codestart => r"(?:^`|~{3,}\s*(?:\{|\{\.|)julia(?:;|\s)(.*)\}\s*$)|(?:^`|~{3,}\s*julia\s*$)",
|
||||||
:codeend => r"^```+\s*$"
|
:codeend => r"^`|~{3,}\s*$"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -35,7 +35,11 @@ function read_document(document, format)
|
||||||
line = lines[lineno]
|
line = lines[lineno]
|
||||||
if (m = match(codestart, line)) != nothing && state=="doc"
|
if (m = match(codestart, line)) != nothing && state=="doc"
|
||||||
state = "code"
|
state = "code"
|
||||||
optionstring=strip(m.captures[1])
|
if m.captures[1] == nothing
|
||||||
|
optionstring = ""
|
||||||
|
else
|
||||||
|
optionstring=strip(m.captures[1])
|
||||||
|
end
|
||||||
@show optionstring
|
@show optionstring
|
||||||
options = Dict{Symbol,Any}()
|
options = Dict{Symbol,Any}()
|
||||||
if length(optionstring) > 0
|
if length(optionstring) > 0
|
||||||
|
|
Loading…
Reference in New Issue