Skip to content

Commit

Permalink
Merge pull request #7 from vdayanand/v/fixmul
Browse files Browse the repository at this point in the history
fix: handle repl mode chars
  • Loading branch information
vdayanand committed May 26, 2023
2 parents 2b544ca + dbb5b34 commit 89268e2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Jupyter2Pluto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,16 @@ function PlutoCell(codecell::JupyterMarkdownCell)
end

function has_multiple_expressions(codecell::JupyterCodeCell)
expressions = Meta.parse("begin "*join(codecell.content, "\n")*" end").args
cellcontent = join(codecell.content, "\n")
replmodechars = r"\W*[\?|\]|;]"
startswith(cellcontent, replmodechars) && return false
expressions = try
codewithbegin = "begin "*cellcontent*" end"
Meta.parse(codewithbegin).args
catch ex
@warn "Failed to parse expression $(codewithbegin)"
return false
end
filter!(x -> !(x isa LineNumberNode), expressions)
length(expressions) > 1
end
Expand Down

0 comments on commit 89268e2

Please sign in to comment.