Browse Source

Rename helper cell Metadata

pull/214/head
Sogari 3 years ago committed by Simon Christ
parent
commit
2225ca7e00
  1. 24
      src/Literate.jl

24
src/Literate.jl

@ -893,13 +893,13 @@ function formatCells(io, ionb, cellCounter, uuids, folds, fold)
return cellCounter return cellCounter
end end
function formatCellsEnd(io, ionb, cellCounter, singleChoiceContent, singleChoiceUuids, singleChoiceFolds, fold) function formatCellsEnd(io, ionb, cellCounter, helperContent, helperUuids, helperFolds, fold)
content = String(take!(io)) content = String(take!(io))
uuid = uuid4(content, cellCounter) uuid = uuid4(content, cellCounter)
cellCounter += 1 cellCounter += 1
push!(singleChoiceUuids, uuid) push!(helperUuids, uuid)
push!(singleChoiceFolds, fold) push!(helperFolds, fold)
push!(singleChoiceContent, content) push!(helperContent, content)
return cellCounter return cellCounter
end end
@ -1077,9 +1077,9 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
# Print cells # Print cells
uuids = Base.UUID[] uuids = Base.UUID[]
singleChoiceUuids = Base.UUID[] helperUuids = Base.UUID[]
singleChoiceFolds = Bool[] helperFolds = Bool[]
singleChoiceContent = String[] helperContent = String[]
folds = Bool[] folds = Bool[]
default_fold = Dict{String,Bool}("markdown"=>true, "code"=>false) # toggleable ??? default_fold = Dict{String,Bool}("markdown"=>true, "code"=>false) # toggleable ???
cellCounter = 1 cellCounter = 1
@ -1121,7 +1121,7 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
for item in helperList for item in helperList
write(io, item, '\n') write(io, item, '\n')
cellCounter = formatCellsEnd(io, ionb, cellCounter, singleChoiceContent, singleChoiceUuids, singleChoiceFolds, fold) cellCounter = formatCellsEnd(io, ionb, cellCounter, helperContent, helperUuids, helperFolds, fold)
end end
else else
# Handle chunks without admonitions # Handle chunks without admonitions
@ -1163,14 +1163,14 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
end end
# Add Question related functions at the end # Add Question related functions at the end
for (i, uuid) in enumerate(singleChoiceUuids) for (i, uuid) in enumerate(helperUuids)
content = singleChoiceContent[i] content = helperContent[i]
print(ionb, "# ╔═╡ ", uuid, '\n') print(ionb, "# ╔═╡ ", uuid, '\n')
write(ionb, content, '\n') write(ionb, content, '\n')
end end
uuids = vcat(uuids, singleChoiceUuids) uuids = vcat(uuids, helperUuids)
folds = vcat(folds, singleChoiceFolds) folds = vcat(folds, helperFolds)
# Print cell order # Print cell order
print(ionb, "# ╔═╡ Cell order:\n# ╟─a0000000-0000-0000-0000-000000000000\n") print(ionb, "# ╔═╡ Cell order:\n# ╟─a0000000-0000-0000-0000-000000000000\n")

Loading…
Cancel
Save