On Sat, Dec 17, 2022, at 19:20, Bruce Leban wrote:
>
> On Sat, Dec 17, 2022 at 10:10 AM <e...@emilstenstrom.se> wrote:
>> I replied to this in a separate post, but html() is likely a function name
>> that is used in millions of existing code bases. Applying this rule to all
>> of them will lead to too many errors to be acceptable to editors I think.
>> And if this has to be explicitly configured in an editor very few will use
>> it.
>
> Understood. This string suffix syntax is supported by Python today and syntax
> highlighters could be modified to support this without requiring changes to
> any other component.
>
> class Calendar(component.Component):
> template_string = '<span class="calendar"></span>' ##html
> css_string = '.calendar { background: pink }' ##css
> js_string = 'document.getElementsByClassName("calendar")[0].onclick =
> function() { alert("click!") }' ##javascript
>
> --- Bruce
PyCharm supports syntax similar to this. They put a # language=html on the line
in front of the string. I think this is messy for the reasons in my original
post, but maybe this is the only reasonable way forward. I'll see if I can ask
the vscode python language extension team what they think.
Nice to see you fixed the syntax error in the js too! :)
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/XXIAQD5BMVEYFD3MUCXT7XOC5WLFZ64L/
Code of Conduct: http://python.org/psf/codeofconduct/