Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ignored continued=false in parse() #65

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/Literate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down