Skip to content

Commit

Permalink
allow alternative keyword app for model
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Jan 3, 2024
1 parent 65b2f3d commit 70799a8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ReactiveTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,16 @@ macro page(expressions...)
# therefore find indexes of positional arguments by hand
inds = findall(x -> !isa(x, Expr) || x.head (:parameters, :(=)), expressions)
length(inds) < 2 && throw("Positional arguments 'url' and 'view' required!")
# allow for keyword `app` instead of `model`
for a in expressions
if a isa Expr
if a.head == :(=) && a.args[1] == :app
a.args[1] = :model
elseif a.head == :parameters && a.args[1].head == :kw && a.args[1].args[1] == :app
a.args[1].args[1] = :model
end
end
end
url, view = expressions[inds[1:2]]
kwarg_inds = setdiff(1:length(expressions), inds)
args = Stipple.expressions_to_args(
Expand Down

0 comments on commit 70799a8

Please sign in to comment.