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

If statement wrapping attributes need white at the end #37

Open
allcaps opened this issue Oct 19, 2020 · 1 comment
Open

If statement wrapping attributes need white at the end #37

allcaps opened this issue Oct 19, 2020 · 1 comment
Labels
bug Something isn't working parser This issue relates to Curlylint’s templates parser
Milestone

Comments

@allcaps
Copy link

allcaps commented Oct 19, 2020

Curlylint wants a space after {% endif %}. But this seems valid scenario to me:

 <form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}"></form>

It raises:

Parse error: expected one of '>', '\\s+', '{#', '{%', '{{' at 45:70	parse_error

Curlylint is okay when 'shifting' the white:

<form{% if has_file_field %} enctype="multipart/form-data"{% endif %} action="{{ form_url }}"></form>

I used curlylint, version 0.12.0

@allcaps allcaps added the bug Something isn't working label Oct 19, 2020
@thibaudcolas
Copy link
Owner

Hey @allcaps, thank you for taking the time to report this!

This needs fixing, I don’t know what change exactly is needed, but the code is here:

attrs = interpolated(
(
whitespace.then(jinja_attr) | mandatory_whitespace.then(attribute)
).many()
)

I’m working on adding more tests for the parser. Once they’re in place, it should hopefully be much easier to fix things like this.

@thibaudcolas thibaudcolas added the parser This issue relates to Curlylint’s templates parser label Mar 13, 2021
@thibaudcolas thibaudcolas added this to the v0.14.0 milestone Apr 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser This issue relates to Curlylint’s templates parser
Projects
None yet
Development

No branches or pull requests

2 participants