Function: shr-parse-style

shr-parse-style is a byte-compiled function defined in shr.el.gz.

Signature

(shr-parse-style STYLE)

Source Code

;; Defined in /usr/src/emacs/lisp/net/shr.el.gz
(defun shr-parse-style (style)
  (when style
    (setq style (replace-regexp-in-string "\n" " " style))
    (let ((plist nil))
      (dolist (elem (split-string style ";"))
	(when elem
	  (setq elem (split-string elem ":"))
	  (when (and (car elem)
		     (cadr elem))
	    (let ((name (replace-regexp-in-string "^ +\\| +$" "" (car elem)))
		  (value (replace-regexp-in-string "^ +\\| +$" "" (cadr elem))))
	      (when (string-match " *!important\\'" value)
		(setq value (substring value 0 (match-beginning 0))))
	      (unless (equal value "inherit")
		(push (cons (intern name obarray)
			    value)
		      plist))))))
      plist)))