Skip to content

unicode as special character in attribute names #179

Description

@dfroger

Hi,

A common issue is to specify attributes with the special characters - : . @ fom htmx, Alpine.js or Datastart.

This issue is covered by #141, but another possibility that I think has not been discussed is using Unicode chars, for example:

from htpy import button, configure, form

configure(
    attribute_renaming={
        "ˉ": "-",
        "ꓽ": ":",
        "ᐧ": ".",
        "ᵒ": "@",
    }
)

form(
    id="",
    xˉdata="",
    xˉonꓽreportˉsuccessᐧwindow="",
    hxˉpost="",
    hxˉtarget="",
    hxˉswap="",
    hxˉindicator="",
    hxˉdisabledˉelt="",
    hxˉonꓽhtmxꓽresponseˉerror="",
)

button(
    id="",
    type="",
    class_="",
    ꓽdisabled="",
    ᵒclick_prevent="",
)

It's harder to write, but easier to read. It's compact and generic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions