Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Option<T> attributes #306

Merged
merged 3 commits into from
Oct 29, 2021

Conversation

zopieux
Copy link
Contributor

@zopieux zopieux commented Oct 19, 2021

Introduces the attr=[value] syntax that assumes value is an Option<T>. Renders attr="value" for Some(value) and entirely omits the attribute for None.

Implements and therefore closes #283.

@zopieux
Copy link
Contributor Author

zopieux commented Oct 19, 2021

FYI the examples CI looks broken.

@lambda-fairy
Copy link
Owner

Thanks @zopieux! I'm busy right now but I'll have a look over the weekend.

FYI the examples CI looks broken.

Yep that's rust-lang/rust#89935 🙂

Copy link
Owner

@lambda-fairy lambda-fairy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zopieux!

I have a few suggestions which should make the code simpler.

Happy to merge once those are resolved.

maud_macros/src/generate.rs Outdated Show resolved Hide resolved
maud_macros/src/ast.rs Outdated Show resolved Hide resolved
docs/content/elements-attributes.md Outdated Show resolved Hide resolved
docs/content/elements-attributes.md Outdated Show resolved Hide resolved
maud/tests/basic_syntax.rs Outdated Show resolved Hide resolved
maud_macros/src/parse.rs Outdated Show resolved Hide resolved
@zopieux zopieux force-pushed the attr-toggle branch 4 times, most recently from e17ea0f to b874647 Compare October 28, 2021 19:46
@zopieux zopieux requested a review from lambda-fairy October 28, 2021 19:47
Introduces the `attr=[value]` syntax that assumes `value` is an
`Option<T>`. Renders `attr="value"` for `Some(value)` and entirely
omits the attribute for `None`.

Implements and therefore closes lambda-fairy#283.
Copy link
Owner

@lambda-fairy lambda-fairy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zopieux!

I added a couple minor changes that you can look through if you like.

@lambda-fairy lambda-fairy merged commit 2909e51 into lambda-fairy:main Oct 29, 2021
@zopieux zopieux deleted the attr-toggle branch October 29, 2021 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support toggling attributes that have a value
2 participants