mirror of https://github.com/mpastell/Weave.jl
Added tangle option to code chunks, closes #33
parent
3df46a118a
commit
0c847f2378
15
src/Weave.jl
15
src/Weave.jl
|
@ -60,13 +60,16 @@ function tangle(source ; out_path=:doc, informat="noweb")
|
||||||
cwd = get_cwd(doc, out_path)
|
cwd = get_cwd(doc, out_path)
|
||||||
|
|
||||||
outname = "$(cwd)/$(doc.basename).jl"
|
outname = "$(cwd)/$(doc.basename).jl"
|
||||||
open(outname, "w") do io
|
open(outname, "w") do io
|
||||||
for chunk in doc.chunks
|
for chunk in doc.chunks
|
||||||
if typeof(chunk) == CodeChunk
|
if typeof(chunk) == CodeChunk
|
||||||
write(io, chunk.content*"\n")
|
options = merge(rcParams[:chunk_defaults], chunk.options)
|
||||||
end
|
if options[:tangle]
|
||||||
end
|
write(io, chunk.content*"\n")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
info("Writing to file $(doc.basename).jl")
|
info("Writing to file $(doc.basename).jl")
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,7 @@ const defaultParams =
|
||||||
:fig=> true,
|
:fig=> true,
|
||||||
:include=> true,
|
:include=> true,
|
||||||
:eval => true,
|
:eval => true,
|
||||||
|
:tangle => true,
|
||||||
:cache => false,
|
:cache => false,
|
||||||
:fig_cap=> nothing,
|
:fig_cap=> nothing,
|
||||||
#Size in inches
|
#Size in inches
|
||||||
|
|
|
@ -16,7 +16,7 @@ println(x)
|
||||||
@
|
@
|
||||||
|
|
||||||
|
|
||||||
<<eval=false>>=
|
<<eval=false; tangle=false>>=
|
||||||
y = randn(5)
|
y = randn(5)
|
||||||
println("Don't eval, but show code")
|
println("Don't eval, but show code")
|
||||||
@
|
@
|
||||||
|
|
|
@ -8,9 +8,6 @@ println(x)
|
||||||
println("Results without code")
|
println("Results without code")
|
||||||
println(x)
|
println(x)
|
||||||
|
|
||||||
y = randn(5)
|
|
||||||
println("Don't eval, but show code")
|
|
||||||
|
|
||||||
y = 1:5
|
y = 1:5
|
||||||
println(y)
|
println(y)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue