Replies: 2 comments 2 replies
-
I'd argue that in these examples To make certain the htpy variation of this reads with the right precedence rules, I'd like the replacement for One alternative is to use double underscore:
|
Beta Was this translation helpful? Give feedback.
-
With an afterthought, I think we could reuse my initial proposal to have Uppercase letter to emulate the dot
|
Beta Was this translation helpful? Give feedback.
-
Hi,
As a lot of my fellow pythonistas, I've been playing a lot lately with frontend frameworks that play well with server side rendering, namely
htmx
andalpinejs
. And like most of other frontend frameworks, those rely on adding somehtml
element attributes that are not standard and contain non alpha characters. Luckilyhtpy
handles this just fine with the help ofdict
attributes but my OCD is striking again as I hate to have one or two attributes styled differently from the others.From my experience, 90% of the time, you need to switch to
dict
attributes to handle just 2 special characters : at sign@
and colon sign:
. Knowing that with most frontend frameworks that I know of (Alpine, HTMX, Vue), the@
sign is syntactic sugar and can be replaced with another syntax involving the colon sign:
, I would consider that handling the colon sign:
alone would in fact avoid having to switch to thedict
attribute syntax 90% of the time.Now my proposal is the following: allow element attributes to contain upper case chars and consider that an upper case char is in fact the lower case equivalent preceded by a colon sign
:
.Here's what it would look like in the end:
@click
hx-on:click
hx_onClick
hx-on:htmx:config-request
hx_onHtmxConfig_request
@click
x-on:click
x_onClick
v-bind:src
:src
v_bindSrc
orSrc
Happy to discuss about this proposal that I think would be a great quality of life improvement for htpy.
Beta Was this translation helpful? Give feedback.
All reactions