Added tangle option to code chunks, closes #33

pull/35/head
Matti Pastell 2016-04-22 09:26:27 +03:00
parent 3df46a118a
commit 0c847f2378
4 changed files with 11 additions and 10 deletions

View File

@ -60,13 +60,16 @@ function tangle(source ; out_path=:doc, informat="noweb")
cwd = get_cwd(doc, out_path)
outname = "$(cwd)/$(doc.basename).jl"
open(outname, "w") do io
for chunk in doc.chunks
if typeof(chunk) == CodeChunk
write(io, chunk.content*"\n")
end
end
open(outname, "w") do io
for chunk in doc.chunks
if typeof(chunk) == CodeChunk
options = merge(rcParams[:chunk_defaults], chunk.options)
if options[:tangle]
write(io, chunk.content*"\n")
end
end
end
end
info("Writing to file $(doc.basename).jl")
end

View File

@ -13,6 +13,7 @@ const defaultParams =
:fig=> true,
:include=> true,
:eval => true,
:tangle => true,
:cache => false,
:fig_cap=> nothing,
#Size in inches

View File

@ -16,7 +16,7 @@ println(x)
@
<<eval=false>>=
<<eval=false; tangle=false>>=
y = randn(5)
println("Don't eval, but show code")
@

View File

@ -8,9 +8,6 @@ println(x)
println("Results without code")
println(x)
y = randn(5)
println("Don't eval, but show code")
y = 1:5
println(y)