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

feature request: boolean attributes #40

Closed
kthy opened this issue Oct 11, 2021 · 4 comments
Closed

feature request: boolean attributes #40

kthy opened this issue Oct 11, 2021 · 4 comments

Comments

@kthy
Copy link
Contributor

kthy commented Oct 11, 2021

In HTML5, there are a number of boolean attributes, e.g. async, checked and disabled. It would be nice if these could be recognized and simply output as their short form. Currently, as a workaround, you can give them an empty string or their own name as value, e.g.

_script(_src="foo.js", _async="async")

gives

<script src="foo.js" async="async"/>

but would be nice if we could have

<script src="foo.js" async/>
@byteface
Copy link
Owner

i remember about a year ago thinking about and looking into this for a few hours. can't remember what i did about it. I think I gave up. but calling the same name or empty for those attrs is a good idea.

you think a few cheeky classes in the namespace i.e async_, checked_, disabled_ may also work as additional?. how many does it apply to . all attributes? or just a small handful? I will investigate this a get back to you soon. It's a good one.

@byteface
Copy link
Owner

ignore my namespace idea. i think yours is better. empty for me would be most natural thing to do.

@byteface
Copy link
Owner

it actually ties in though to a bigger thought process. about being able to configure the default behaviour. I've been thinking for a whlie about some config settings for domonic. so that you could flag it do do certain types of output. i.e. so a flag to auto do that for you. that's on by default.

@byteface
Copy link
Owner

with such a config you could omit closing tags on lists for example and do cool html5 things.

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

No branches or pull requests

2 participants