Skip to content

Commit

Permalink
Parser fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Salceanu committed Apr 18, 2020
1 parent 92142c7 commit d98b3d5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Configuration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ julia> Configuration.env()
env() :: String = Genie.config.app_env


buildpath() :: String = Base.Filesystem.mktempdir(prefix = "jl_genie_build_")
buildpath() :: String = Base.Filesystem.mktempdir(prefix = "jl_genie_build_", cleanup = false)


"""
Expand Down
23 changes: 18 additions & 5 deletions src/renderers/Html.jl
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,18 @@ function html(viewfile::Genie.Renderer.FilePath; layout::Union{Nothing,Genie.Ren
end


function safe_attr(attr)
attr = string(attr)

occursin("-", attr) && replace!(attr, "-"=>Genie.config.html_parser_char_dash)
occursin(":", attr) && replace!(attr, ":"=>Genie.config.html_parser_char_column)
occursin("@", attr) && replace!(attr, "@"=>Genie.config.html_parser_char_at)
occursin(".", attr) && replace!(attr, "."=>Genie.config.html_parser_char_dot)

attr
end


"""
parsehtml(elem, output, depth; partial = true) :: String
Expand Down Expand Up @@ -437,11 +449,12 @@ function parsehtml(elem::HTMLParser.HTMLElement, depth::Int = 0; partial::Bool =
continue
end

if occursin(Genie.config.html_parser_char_dash, k) ||
occursin(Genie.config.html_parser_char_column, k) ||
occursin(Genie.config.html_parser_char_at, k) ||
occursin(Genie.config.html_parser_char_dot, k) ||
if occursin("-", k) ||
occursin(":", k) ||
occursin("@", k) ||
occursin(".", k) ||
occursin("for", k)

push!(attributes_keys, Symbol(k) |> repr)

v = string(v) |> repr
Expand Down Expand Up @@ -655,7 +668,7 @@ end

function register_element(elem::Union{Symbol,String}, elem_type::Union{Symbol,String} = :normal; context = @__MODULE__) :: Nothing
elem = string(elem)
occursin('-', elem) && (elem = denormalize_element(elem))
occursin("-", elem) && (elem = denormalize_element(elem))

elem_type == :normal ? register_normal_element(elem) : register_void_element(elem)
end
Expand Down

2 comments on commit d98b3d5

@essenciary
Copy link
Member

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/13260

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.30.0 -m "<description of version>" d98b3d53df0008e51f720a9a8f1cdd83b5e06173
git push origin v0.30.0

Please sign in to comment.