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

Using == in a th:with tag on the body element when a layout also has a th:with tag doesn't work #244

Open
lifeweaver opened this issue Jan 7, 2025 · 2 comments
Assignees
Labels

Comments

@lifeweaver
Copy link

First off thank you for writing this library, it's helpful.

thymeleaf-layout-dialect version 3.3.0 in an application using Spring.

Example "isA = ${ a == b ? true : false}" results in the VariableDeclaration's name being "isA" and the value being "${ a ", which is incorrect.

If the above expression is modified to us 'eq" vs '==' it works fine. The issue also holds true with "!=".

Seems like all equal signs are split not just the first one. (From the VariableDeclaration object):
(name, value) = assignation.stringRepresentation.split('=')

@ultraq ultraq added the bug label Jan 8, 2025
@ultraq
Copy link
Owner

ultraq commented Jan 8, 2025

Ah, this might be due to the very naive string processing to extract variables, which is likely related to #222 raised a while ago.

I'm struggling to remember why I may have done my own string processing here instead of finding something in Thymeleaf that can do it - I should be able to hand it off to Thymleaf to resolve this bug 🤔

@ultraq ultraq self-assigned this Jan 8, 2025
@lifeweaver
Copy link
Author

Sorry I did not see #222. As to handing it off to Thymeleaf, perhaps it's related to how Thymeleaf handles it differently base on if Thymeleaf is used with Spring or not. I think it's OGNL vs SpringEL? Or maybe it was thought it was overkill since it's just about merging them without actually processing them?

For my use I was able to just not use a th:with tag in my layout file to avoid the issue, since it only occurs when merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants