Support Chameleon attribute expressions.#213
Open
thet wants to merge 3 commits into
Open
Conversation
Fix incorrect splitting of Chameleon attribute expressions which led to
broken code.
This HTML `<input type="text" ${python: "required" if view.required else ""} />`
leads now correctly to:
```html
<input type="text"
${python: "required" if view.required else ""}
/>
```
efd1ca0 to
5c67c34
Compare
ale-rt
reviewed
May 11, 2026
Member
ale-rt
left a comment
There was a problem hiding this comment.
This is broken XML and I think it is not allowed by Chameleon.
It seems to me that you should replace:
${python: "required" if view.required else ""}with:
required="${python: "required" if view.required else ""}Am I wrong?
Member
|
@ale-rt since HTML5 it is no longer strictly speaking XML anymore 🙃 https://stackoverflow.com/questions/5558502/is-html5-valid-xml and plenty of other examples |
…s not sorted and the restoration was messed up.
for more information, see https://pre-commit.ci
Member
Thanks for the heads up, but this HTML is not relevant here. The point is that <h1 ${python: "hidden" if False else ""}>Plone User Interface elements test page</h1>It breaks with: The proper syntax is: <h1 hidden="${python: 'hidden' if False else None}">Plone User Interface elements test page</h1>I would say this PR is invalid. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix incorrect splitting of Chameleon attribute expressions which led to broken code.
This HTML
<input type="text" ${python: "required" if view.required else ""} />leads now correctly to:Note: without this fix it is:
Note 2: This vix is vibe coded. The previous two PRs are not.