Skip to content

Consistent naming scheme for html and svg elements. #72

Open
@Drup

Description

@Drup

Consistency is not W3C's strong point, but it's made worse in tyxml. The main pain point is dashes, since they are not valid in ocaml's identifiers.

So a more formal version of what we are currently loosely applying:

  • We always keep the name in the specification if it's a valid ocaml identifier, be it snake_case, nocase, CamlCase or whatever, even if it's internally inconsistent (I'm looking at you, fontFace)

  • Dashes are transformed in underscores systematically.

  • Underscores are kept.

  • Any other characters that could ever appear are transformed in an underscore too. I don't think I ever saw one, but better be sure.

  • In case of conflict between attributes of incompatible types. We put the element that it's disambiguated for between underscores, after the a.

    Example: the attribute max for input is transformed in a_input_max.

  • Specific transformation rules:

    • When transforming to an element, the first letter become a lowercase.
    • When transforming to a polymorphic variant, the first letter is capitalized. This is not mandatory (since polymorphic variant can start with a lowercase), but it's acceptable and is already applied almost consistently, so better keep it.
    • When transforming to an attribute, no letter is changed (it's ok, it starts with a_).

These should also keep the breaking rather minimal. Remarks ?
cc @dsheets since you might have an opinion. :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions