Skip to content

Naming ambiguity when using directives with arguments and modifiers #49

Description

@alesgenova

Currently we need to keep track manually of the directives / directive-modifier combination that we can support.

I propose a non-ambiguous naming convention that allows us to dynamically convert python keyword arguments into complex vue directives.

  • Use triple ___ to indicate argument separator :
  • Use double __ to indicate modifier separator .

For example:

  • v_model__number -> v-model.number
  • v_on___click -> v-on:click

An extreme example:

  • v_complex_directive_name___complex_arg_value__complex_mod_name1__complex_mod_name2 -> v-complex-directive-name:complex-arg-value.complex-mod-name1.complex-mod-name2

Example implementation:

def py_to_js(s):
    return s.replace("___", ":").replace("__", ".").replace("_", "-")

def js_to_py(s):
    return s.replace(":", "___").replace(".", "__").replace("-", "_")

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions