tlienart / Xranklin.jl

Experimental repo for a refactoring of Franklin.jl
https://tlienart.github.io/Xranklin.jl
MIT License
40 stars 1 forks source link

isempty with estring #191

Closed tlienart closed 1 year ago

tlienart commented 1 year ago
julia> raw"""
       +++
       a = (b="", c="foo")
       +++
       {{isempty e"$a.c"}}
       foo
       {{else}}bar{{end}}
       """ |> html
"<p>\nfoo\n</p>\n"

though to be fair it's ambiguous here.. isempty expects the name of a var, would make more sense to have (actually works)

julia> raw"""
       +++
       a = (b="", c="foo")
       +++
       {{if e"isempty($a.c)"}}
       foo
       {{else}}bar{{end}}
       """ |> html
"<p>bar</p>\n"
tlienart commented 1 year ago

could check, priority for the name of a var, otherwise, if actually an empty string return true, otherwise if anything else return false.