rouge icon indicating copy to clipboard operation
rouge copied to clipboard

Support Angular template syntax in html lexer

Open eiswind opened this issue 2 years ago • 0 comments

Name of the lexer html

Code sample angular html templates may show the following attribute syntax:

#usernameFormControl="ngModel"

Additional context I could workaround by providing my own lexer with a one char change: (the hash is originally not included in the first of the two attribute rules)

state :tag do
    rule %r/\s+/m, Text
    rule %r/[\p{L}:_\[\]()*#.-][\p{Word}\p{Cf}:.·\[\]()*-]*\s*=\s*/m, Name::Attribute, :attr
    rule %r/[\p{L}:_*#-][\p{Word}\p{Cf}:.·*#-]*/, Name::Attribute
    rule %r(/?\s*>)m, Name::Tag, :pop!
  end

I know this is not plain html, but maybe this little change can be included in the html lexer.

eiswind avatar Apr 10 '23 12:04 eiswind