Skip to content

Commit

Permalink
better html interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
fxbois committed Oct 12, 2022
1 parent de9dfa3 commit 8c0baa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions issues/1252.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function getHTML(div){
const html = `<style>div { background: black; }</style> <div>${div}</div>`;
return html;
}
9 changes: 5 additions & 4 deletions web-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

;; Copyright 2011-2022 François-Xavier Bois

;; Version: 17.3.1
;; Version: 17.3.2
;; Author: François-Xavier Bois
;; Maintainer: François-Xavier Bois <[email protected]>
;; Package-Requires: ((emacs "23.1"))
Expand All @@ -23,7 +23,7 @@

;;---- CONSTS ------------------------------------------------------------------

(defconst web-mode-version "17.3.1"
(defconst web-mode-version "17.3.2"
"Web Mode version.")

;;---- GROUPS ------------------------------------------------------------------
Expand Down Expand Up @@ -1093,6 +1093,7 @@ Must be used in conjunction with web-mode-enable-block-face."
(?\> . "&gt;"))
"XML chars")

;; #1254 : https://html.spec.whatwg.org/entities.json
(defvar web-mode-html-entities
;; #985
;; remove ("gt" . 62) ("lt" . 60) ("amp" . 38)
Expand Down Expand Up @@ -7313,15 +7314,15 @@ Also return non-nil if it is the command `self-insert-command' is remapped to."
'web-mode-variable-name-face)
)
(cond
((web-mode-looking-back "\\(css\\|styled[[:alnum:].]+\\)" beg)
((web-mode-looking-back "\\(css\\|styled[[:alnum:].]+\\|css = \\)" beg)
(goto-char (1+ beg))
(while (re-search-forward ".*?:" end t)
(put-text-property (match-beginning 0) (match-end 0)
'font-lock-face
'web-mode-interpolate-color1-face)
)
) ;case css
((web-mode-looking-back "\\(template\\|html\\)" beg)
((web-mode-looking-back "\\(template\\|html\\|html = \\)" beg)
(goto-char (1+ beg))
(while (re-search-forward web-mode-tag-regexp end t)
(put-text-property (match-beginning 1) (match-end 1)
Expand Down

0 comments on commit 8c0baa2

Please sign in to comment.