Skip to content

Commit

Permalink
Allow non registered html elements
Browse files Browse the repository at this point in the history
  • Loading branch information
essenciary committed Feb 28, 2024
1 parent 3367962 commit 027f661
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Genie"
uuid = "c43c736e-a2d1-11e8-161f-af95117fbd1e"
authors = ["Adrian Salceanu <[email protected]> and the amazing Genie contributors ♥️"]
version = "5.26.0"
version = "5.26.1"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand Down
15 changes: 14 additions & 1 deletion src/renderers/Html.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,20 @@ end
Generates a HTML element in the form <...></...>
"""
function normal_element(f::Function, elem::Any, args::Vector = [], attrs::Vector{Pair{Symbol,Any}} = Pair{Symbol,Any}[]) :: HTMLString
normal_element(Base.invokelatest(f), string(elem), args, attrs...)
try
normal_element(Base.invokelatest(f), string(elem), args, attrs...)
catch ex
@warn ex
if isa(ex, UndefVarError) # tag function does not exist, let's register it
try
register_normal_element(ex.var |> string)
normal_element(Base.invokelatest(f), string(elem), args, attrs...)
catch ex
@error ex
""
end
end
end
end
function normal_element(children::Union{T,Vector{T}}, elem::Any, args::Vector, attrs::Pair{Symbol,Any})::HTMLString where {T<:AbstractString}
normal_element(children, string(elem), args, Pair{Symbol,Any}[attrs])
Expand Down

0 comments on commit 027f661

Please sign in to comment.