web-mode icon indicating copy to clipboard operation
web-mode copied to clipboard

Issue with unquoted HTML attribute values defined in another language

Open lcoq opened this issue 3 years ago • 2 comments

Theory

HTML unquoted attribute values defined in a non-HTML language are not considered as valid attribute values. Therefore the HTML parser expects next string to define the attribute value.

Consequences

It produces both syntax highlighting issue and indentation issue, at least with ERB and HBS templates, but I'm pretty sure this appears with every language combined with HTML.

Example

web-mode-erb-invalid

web-mode-hbs-invalid

In the examples above, bar="baz" has 2 problems :

  1. Highlighting issue : the face used is face(web-mode-html-attr-value-face)
  2. Indentation issue : it should start at the same indentation as foo

Related specs :

Related issues :

  • #1150
  • #1136

lcoq avatar Feb 22 '22 11:02 lcoq

please post the examples on gist

fxbois avatar May 24 '22 20:05 fxbois

ERB : https://gist.github.com/lcoq/57e3dafe3519a1ee145fabdf57ecf90f HBS : https://gist.github.com/lcoq/647b0f89219404518425d0bb3e2cb4c9

lcoq avatar May 25 '22 05:05 lcoq

I've pushed a fix

fxbois avatar Dec 25 '22 12:12 fxbois