Exception handling for invalid chunk options

pull/7/head
Matti Pastell 2014-11-27 13:09:42 +02:00
parent 1c2ae8b33b
commit 13458bf001
2 changed files with 8 additions and 2 deletions

View File

@ -110,6 +110,7 @@ function run(parsed)
end
merge!(chunk, options)
delete!(chunk, "options")
chunk["evaluate"] || (chunk["result"] = ""; continue) #Do nothing if eval is false

View File

@ -24,7 +24,12 @@ function read_noweb(document)
if strip(optionstring)==""
options = Dict()
else
options = eval(parse("{" * optionstring * "}"))
try
options = eval(parse("{" * optionstring * "}"))
catch
options = Dict()
warn(string("Invalid format for chunk options line: ", lineno))
end
end
haskey(options, "label") && (options["name"] = options["label"])
haskey(options, "name") || (options["name"] = nothing)
@ -47,7 +52,7 @@ function read_noweb(document)
continue
end
content *= "\n" * line
content *= "\n" * line
end
#Remember the last chunk