Function: htmlize-decode-face-prop

htmlize-decode-face-prop is a byte-compiled function defined in htmlize.el.

Signature

(htmlize-decode-face-prop PROP)

Documentation

Turn face property PROP into a list of face-like objects.

Source Code

;; Defined in ~/.emacs.d/elpa/htmlize-20250724.1703/htmlize.el
(defun htmlize-decode-face-prop (prop)
  "Turn face property PROP into a list of face-like objects."
  ;; PROP can be a symbol naming a face, a string naming such a
  ;; symbol, a cons (foreground-color . COLOR) or (background-color
  ;; COLOR), a property list (:attr1 val1 :attr2 val2 ...), or a list
  ;; of any of those.
  ;;
  ;; (htmlize-decode-face-prop 'face) -> (face)
  ;; (htmlize-decode-face-prop '(face1 face2)) -> (face1 face2)
  ;; (htmlize-decode-face-prop '(:attr "val")) -> ((:attr "val"))
  ;; (htmlize-decode-face-prop '((:attr "val") face (foreground-color "red")))
  ;;   -> ((:attr "val") face (foreground-color "red"))
  ;;
  ;; Unrecognized atoms or non-face symbols/strings are silently
  ;; stripped away.
  (cond ((null prop)
         nil)
        ((symbolp prop)
         (and (facep prop)
              (list prop)))
        ((stringp prop)
         (and (facep (intern-soft prop))
              (list prop)))
        ((atom prop)
         nil)
        ((and (symbolp (car prop))
              (eq ?: (aref (symbol-name (car prop)) 0)))
         (list prop))
        ((or (eq (car prop) 'foreground-color)
             (eq (car prop) 'background-color))
         (list prop))
        (t
         (apply #'nconc (mapcar #'htmlize-decode-face-prop prop)))))