From 548fc73965a8f8ad551e4c092f88c45e1b00f20e Mon Sep 17 00:00:00 2001 From: Guillermo Garza Date: Tue, 28 May 2019 19:34:01 -0500 Subject: [PATCH] Fix ignored continued=false in parse() This fixes a situation where the continued=false option in parse() was ignored during notebook export. --- src/Literate.jl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Literate.jl b/src/Literate.jl index a5d46f3..20f2684 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -78,17 +78,19 @@ function parse(content; allow_continued = true) end end - # find code chunks that are continued - last_code_chunk = 0 - for (i, chunk) in enumerate(chunks) - isa(chunk, MDChunk) && continue - if startswith(last(chunk.lines)," ") - chunk.continued = true - end - if startswith(first(chunk.lines)," ") - chunks[last_code_chunk].continued = true + if allow_continued + # find code chunks that are continued + last_code_chunk = 0 + for (i, chunk) in enumerate(chunks) + isa(chunk, MDChunk) && continue + if startswith(last(chunk.lines)," ") + chunk.continued = true + end + if startswith(first(chunk.lines)," ") + chunks[last_code_chunk].continued = true + end + last_code_chunk = i end - last_code_chunk = i end # if we don't allow continued code blocks we need to merge MDChunks into the CodeChunks