ZPT compatibility #3874
Replies: 2 comments 3 replies
-
|
Currently it isn't supported or configurable. So the only way would be to use x-bind to handle those that need this. :attributes="5"
// to
x-bind="{ attributes: 5 }"Since it seems ZPT is a preprocessor or something, then implementing compatibility there is more sensible. Like providing it a list of directives that it doesn't handle itself. Since it could impact many different things, not just Alpine. |
Beta Was this translation helpful? Give feedback.
-
|
I'm aware that it's not currently supported, I intended my post to be a feature request. The list of directives ZPT can't handle is: all directives containing a colon. The part on the left of a colon is interpreted as namespace prefix in ZPT thus throwing an error (there is also an error if it's a shorthand starting with a colon, like Thank you for pointing out the I'm not really in an impasse here, since I can handle the problematic directives with I know Zope is not so widespread anymore, but to my knowledge this kind of template syntax is used in other projects as well, such as Chameleon or PHPTAL, so it might be worthwile to have a solution to make alpine more compatible with it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using alpine.js with Zope Page Templates, all directives containing a colon provoke a compilation error
unknown namespace directive.For some directives, there is the possibility to just use the shorthand version as a workaround, like
x-on:click→@click. Unfortunately there are directives whose shortcut also contains a colon, such as:attributes.Fortunately there is a workaround in Zope, that's using
tal:attributesto create the directive dynamically:<button tal:attributes="x-on:click string:alert('')">alert</button>. This works fine, but it makes the code somewhat less readable.Maybe there could be an alternative to the colon that works with the alpine parser, some other character that's not used in any known programming context like
§or…(U+2026), eg:x-on§click=alert('')orx-on…click=alert('').I also wouldn't mind having to specify the new separator explicitly, for example in
x-init.Beta Was this translation helpful? Give feedback.
All reactions