Function: web-mode-interpolate-javascript-literal

web-mode-interpolate-javascript-literal is a natively compiled function defined in web-mode.el.

Signature

(web-mode-interpolate-javascript-literal BEG END)

Source Code

;; Defined in /nix/store/2qgnz1rp30nzfz6w0apx4kdm14if1bbs-emacs-packages-deps/share/emacs/site-lisp/elpa/web-mode-20260831.219/web-mode.el
(defun web-mode-interpolate-javascript-literal (beg end)
  (save-excursion
    (setq end (1- end))
    (goto-char (1+ beg))
    (cond
      ((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\\|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)
                            'font-lock-face
                            'web-mode-interpolate-color1-face)
         )
       (goto-char (1+ beg))
       (while (re-search-forward "</?\\|/?>\\| [.@?]?[[:alnum:]]+=" end t)
         (cond
           ((member (char-after (match-beginning 0)) '(?\< ?\/ ?\>))
            (put-text-property (match-beginning 0) (match-end 0)
                               'font-lock-face
                               'web-mode-interpolate-color2-face)
            )
           (t
            (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))
                               'font-lock-face
                               'web-mode-interpolate-color3-face)
            ) ;t
           ) ;cond
         ) ;while
       (goto-char (1+ beg))
       (while (re-search-forward "<\\(script\\|style\\)>\\(.*\\)</\\(script\\|style\\)>" end t)
         (put-text-property (match-beginning 2) (match-end 2)
                            'font-lock-face
                            'web-mode-interpolate-color4-face)
         )
       ) ;case html
      ) ;cond type of literal
    (goto-char (1+ beg))
    (while (re-search-forward "${.*?}" end t)
      (put-text-property (match-beginning 0) (match-end 0)
                         'font-lock-face
                         'web-mode-variable-name-face)
      ) ;while
    ))