|
|
|
|
@ -868,8 +868,7 @@ function writeLogic(questionName, questionDict)
@@ -868,8 +868,7 @@ function writeLogic(questionName, questionDict)
|
|
|
|
|
""" |
|
|
|
|
function $(questionName)Test($(questionName)Answer) |
|
|
|
|
return $(questionName)Answer == "$(questionDict["correct"])" |
|
|
|
|
end; |
|
|
|
|
""" |
|
|
|
|
end;""" |
|
|
|
|
return logic |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
@ -887,6 +886,9 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
@@ -887,6 +886,9 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
|
|
|
|
|
|
|
|
|
|
# Print cells |
|
|
|
|
uuids = Base.UUID[] |
|
|
|
|
singleChoiceUuids = Base.UUID[] |
|
|
|
|
singleChoiceFolds = Bool[] |
|
|
|
|
singleChoiceContent = String[] |
|
|
|
|
folds = Bool[] |
|
|
|
|
default_fold = Dict{String,Bool}("markdown"=>true, "code"=>false) # toggleable ??? |
|
|
|
|
cellCounter = 1 |
|
|
|
|
@ -1036,24 +1038,20 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
@@ -1036,24 +1038,20 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
|
|
|
|
|
content = String(take!(io)) |
|
|
|
|
uuid = uuid4(content, cellCounter) |
|
|
|
|
cellCounter += 1 |
|
|
|
|
push!(uuids, uuid) |
|
|
|
|
push!(folds, fold) |
|
|
|
|
print(ionb, "# ╔═╡ ", uuid, '\n') |
|
|
|
|
write(ionb, content, '\n') |
|
|
|
|
push!(singleChoiceUuids, uuid) |
|
|
|
|
push!(singleChoiceFolds, fold) |
|
|
|
|
push!(singleChoiceContent, content) |
|
|
|
|
|
|
|
|
|
write(io, logicBind, '\n') |
|
|
|
|
write(io, '\n') |
|
|
|
|
content = String(take!(io)) |
|
|
|
|
uuid = uuid4(content, cellCounter) |
|
|
|
|
cellCounter += 1 |
|
|
|
|
push!(uuids, uuid) |
|
|
|
|
push!(folds, fold) |
|
|
|
|
print(ionb, "# ╔═╡ ", uuid, '\n') |
|
|
|
|
write(ionb, content, '\n') |
|
|
|
|
push!(singleChoiceUuids, uuid) |
|
|
|
|
push!(singleChoiceFolds, fold) |
|
|
|
|
push!(singleChoiceContent, content) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
write(io, '\n') |
|
|
|
|
|
|
|
|
|
end |
|
|
|
|
content = String(take!(io)) |
|
|
|
|
else # isa(chunk, CodeChunk) |
|
|
|
|
@ -1084,6 +1082,15 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
@@ -1084,6 +1082,15 @@ function create_notebook(flavor::PlutoFlavor, chunks, config)
|
|
|
|
|
write(ionb, content, '\n') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
for (i, uuid) in enumerate(singleChoiceUuids) |
|
|
|
|
content = singleChoiceContent[i] |
|
|
|
|
print(ionb, "# ╔═╡ ", uuid, '\n') |
|
|
|
|
write(ionb, content, '\n') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
uuids = vcat(uuids, singleChoiceUuids) |
|
|
|
|
folds = vcat(folds, singleChoiceFolds) |
|
|
|
|
|
|
|
|
|
# Print cell order |
|
|
|
|
print(ionb, "# ╔═╡ Cell order:\n# ╟─a0000000-0000-0000-0000-000000000000\n") |
|
|
|
|
foreach(((x, f),) -> print(ionb, "# $(f ? "╟─" : "╠═")", x, '\n'), zip(uuids, folds)) |
|
|
|
|
|