Skip to content

Commit

Permalink
I885 (#886)
Browse files Browse the repository at this point in the history
* fix for empty exs need test

* closes #855

* patch release
  • Loading branch information
tlienart authored Sep 19, 2021
1 parent 3c8353f commit 4c5697f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Franklin"
uuid = "713c75ef-9fc9-4b05-94a9-213340da978e"
authors = ["Thibaut Lienart <[email protected]>"]
version = "0.10.54"
version = "0.10.55"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand Down
8 changes: 4 additions & 4 deletions src/converter/html/blocks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function process_html_cond(hs::AS, qblocks::Vector{AbstractBlock},
k ⊻= βi isa HIsNotDef
elseif βi isa Union{HIsEmpty, HIsNotEmpty}
v = locvar(βi.vname)
e = _isempty(v)
e = _isemptyvar(v)
k = ifelse(βi isa HIsEmpty, e, !e)
end
else
Expand Down Expand Up @@ -155,9 +155,9 @@ function process_html_cond(hs::AS, qblocks::Vector{AbstractBlock},
end

# used for the HIsEmpty, HIsNotEmpty
_isempty(v::T) where T = hasmethod(isempty, (T,)) ? isempty(v) : false
_isempty(::Nothing) = true
_isempty(v::Date) = (v == Date(1,1,1))
_isemptyvar(v::T) where T = hasmethod(isempty, (T,)) ? isempty(v) : false
_isemptyvar(::Nothing) = true
_isemptyvar(v::Date) = (v == Date(1,1,1))


"""
Expand Down
8 changes: 8 additions & 0 deletions src/eval/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ function run_code(mod::Module, code::AS, out_path::AS;
err = nothing
stacktrace = nothing
ispath(out_path) || mkpath(dirname(out_path))

# we do this here so that `out_path` is still generated to avoid
# issue #885
if isempty(exs)
write(out_path, "")
return nothing
end

open(out_path, "w") do outf
if !FD_ENV[:SILENT_MODE]::Bool
rprint("→ evaluating code [$(out_path |> basename |> splitext |> first)] in ($(locvar("fd_rpath")))")
Expand Down
2 changes: 1 addition & 1 deletion test/eval/run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ end
Random.seed!(555)
println("hello")
b = randn()
b > 0
iszero(b)
"""
r = F.run_code(mod1, c, junk)

Expand Down

2 comments on commit 4c5697f

@tlienart
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/45171

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.55 -m "<description of version>" 4c5697f695116980ac0c8af45fd65fa68653ed9b
git push origin v0.10.55

Please sign in to comment.