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 with parens fails to parse #882

Closed
tinct-martini opened this issue Dec 13, 2023 · 4 comments · Fixed by #908
Closed

if statement with parens fails to parse #882

tinct-martini opened this issue Dec 13, 2023 · 4 comments · Fixed by #908

Comments

@tinct-martini
Copy link

The following fails to parse with tera but works fine with jinja2:

{% if (brand.id == "barfoo") or (brand.id == "foobar") %}LOL{% endif %}

with the following error:

Tera error: Error { kind: Msg("Failed to parse 'test.html'"), source: Some(Error { kind: Msg(" --> 1:17\n  |\n1 | {% if (brand.id == \"barfoo\") or (brand.id == \"foobar\") %}LOL{% endif %}\n  |                 ^---\n  |\n  = expected `+`, `-`, `*`, `/`, or `%`"), source: None }) }

Changing the template to something more reasonable also fails with the exact same error:

{% if (brand.id == "barfoo" or brand.id == "foobar") %}LOL{% endif %}

I know the first example is a bit silly and you're not aiming for 100% jinja compatibility but do you think this could be fixed?

Thanks in advance!

@Keats
Copy link
Owner

Keats commented Dec 13, 2023

I've just added a test in the next version for that (Keats/tera2@c5dc6c9) and it works

@tinct-martini
Copy link
Author

Do you have a rough timeline for when we can expect terra2? Are we talking days, weeks or months? 😄

@Keats
Copy link
Owner

Keats commented Dec 13, 2023

Definitely closer to months. A beta release will be tested for quite some time in Zola before actually releasing v2 proper

jeremija added a commit to jeremija/tera that referenced this issue Apr 30, 2024
jeremija added a commit to jeremija/tera that referenced this issue Apr 30, 2024
@jeremija jeremija mentioned this issue Apr 30, 2024
@jeremija
Copy link
Contributor

@Keats I just created a PR that should fix the issue, I'd greatly appreciate if you could have a look: #908 🙏

Keats pushed a commit that referenced this issue May 27, 2024
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 a pull request may close this issue.

3 participants