From be9ae2874362de788833cfad1cce667d11134fd7 Mon Sep 17 00:00:00 2001 From: Sogari Date: Sat, 25 Mar 2023 19:56:52 +0100 Subject: [PATCH] Fix single line code cells in pluto nb --- src/Literate.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Literate.jl b/src/Literate.jl index 47dc0de..9d994fe 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -1049,7 +1049,8 @@ function create_notebook(flavor::PlutoFlavor, chunks, config) for line in chunk.lines write(io, line, '\n') end - content = String(take!(io)) + seek(io, 0) + content = read(io, String) # Compute number of expressions in the code block and perhaps wrap in begin/end nexprs, idx = 0, 1 while true @@ -1063,6 +1064,8 @@ function create_notebook(flavor::PlutoFlavor, chunks, config) foreach(l -> print(io, " ", l, '\n'), eachline(IOBuffer(content))) print(io, "end\n") cellCounter = formatCells(io, ionb, cellCounter, uuids, folds, fold) + else + cellCounter = formatCells(io, ionb, cellCounter, uuids, folds, fold) end end