Last active
July 25, 2021 18:58
-
-
Save ctrekker/ba69f09b86ec2fcb68566cfa770ffbb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Pluto | |
function plutostate_to_julia(state::Dict{Any, Any}, juliafile::AbstractString) | |
cell_order = UUID.(state["cell_order"]) | |
cells_dict = Dict([UUID(k) => Pluto.Cell(cell_id=UUID(k), code=v["code"], code_folded=v["code_folded"]) for (k, v) ∈ state["cell_inputs"]]) | |
cells = [cells_dict[id] for id ∈ cell_order] | |
nb = Pluto.Notebook(cells, "", uuid4()) | |
open(juliafile, "w") do io | |
Pluto.save_notebook(io, nb) | |
end | |
end | |
function plutostate_to_julia(statefile::AbstractString, juliafile::AbstractString) | |
contents = open(f->read(f), statefile) | |
state = Pluto.unpack(contents) | |
plutostate_to_julia(state, juliafile) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment