Skip to content

Commit

Permalink
add parsing of textfield and numberfield
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Mar 14, 2023
1 parent 404a580 commit 9d10a25
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/StippleUIParser.jl
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,29 @@ function parse_vue_html(html)
replace(parse_elem(first(eachelement(first(eachelement(doc))))), "__vue-on__" => "@")
end

function function_parser(tag::Val{Symbol("q-input")}, attrs, context = @__MODULE__)
kk = String.(collect(keys(attrs)))
pos = findfirst(startswith(r"fieldname$|var\"v-model."), kk)
if pos === nothing
function_parser(Val(:q__input), attrs)
else
haskey(attrs, "label") || (attrs["label"] = "\"\"")
k = kk[pos]
v = attrs[k]
v_symbol = repr(Symbol(strip(v, '"')))
startswith(v_symbol, ":") && (v = v_symbol)

k == "fieldname" || delete!(attrs, k)
attrs["fieldname"] = v

if k == "var\"v-model.number\""
function_parser(Val(:numberfield), attrs)
else
function_parser(Val(:textfield), attrs)
end
end
end

# precompilation ...

doc_string = """
Expand Down

0 comments on commit 9d10a25

Please sign in to comment.