Feature request: do-block syntax
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Start by reading the proposed (x::Hyperscript.Node)(f::Function, args...; props...) method and the existing Node call behavior. Verify the nested do-block example in the issue works while the current argument-based syntax remains unchanged; the payload names no files or tests, so locate the relevant implementation and test entry points first.
Written by the indexing model from the issue text.
Description
Hi @yurivish, how do you feel about adding a do-block syntax (similar to markaby)? That would allow one to write the following:
using Hyperscript
@tags div em a
# What I'm proposing:
div.header() do
a(href="https://github.com/yurivish/Hyperscript.jl") do
em("Hyperscript.jl")
end
end
instead of
# Current equivalent:
div.header(a(href="https://github.com/yurivish/Hyperscript.jl", em("Hyperscript.jl")))
or, equivalently,
# Indented current equivalent:
div.header(
a(href="https://github.com/yurivish/Hyperscript.jl",
em("Hyperscript.jl")
)
)
That could increase readability in general. Of course, nothing would break; it would only be an alternative way of writing things.
If you like it, I could make a PR 😀
EDIT: a single line is all that's required to make the example above work:
julia> (x::Hyperscript.Node)(f::Function, args...; props...) = x(args..., f(); props...)
julia> div.header() do
a(href="https://github.com/yurivish/Hyperscript.jl") do
em("Hyperscript.jl")
end
end
<div class="header"><a href="https://github.com/yurivish/Hyperscript.jl"><em>Hyperscript.jl</em></a></div>
- Dominant language
- Julia
- Stars
- 105
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from JuliaWeb/Hyperscript.jl
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
JuliaWeb/Hyperscript.jl#46 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
JuliaWeb/Hyperscript.jl#44 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
JuliaWeb/Hyperscript.jl#42 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
JuliaWeb/Hyperscript.jl#40 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
JuliaWeb/Hyperscript.jl#37 ·
All issues in JuliaWeb/Hyperscript.jl
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
JuliaStats/LogExpFunctions.jl#134 · 2 comments ·
-
code bug PowerSystems 6.0
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Sienna-Platform/PowerSystems.jl#1849 ·
Maintainers usually reply within 7 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
FluxML/Metalhead.jl#407 ·
Maintainers usually reply within 1 day