fxbois / web-mode

web template editing mode for emacs
https://web-mode.org
GNU General Public License v3.0
1.63k stars 262 forks source link

Issue with unquoted HTML attribute values defined in another language #1229

Closed lcoq closed 1 year ago

lcoq commented 2 years ago

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 :

fxbois commented 2 years ago

please post the examples on gist

lcoq commented 2 years ago

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

fxbois commented 1 year ago

I've pushed a fix