Allow using multiple content values

This commit is contained in:
Shinmera 2019-05-01 09:05:29 +02:00
parent a8d64a778d
commit 312e250e32
No known key found for this signature in database
GPG key ID: E12B14478BE4C922

View file

@ -143,15 +143,15 @@
(define-special-property font-family (&rest faces)
(list (make-property "font-family" (format NIL "~{~a~^, ~}" (mapcar #'resolve faces)))))
(define-special-property content (content)
;; Backwards compat with the usage of "'foo'" in LASS files
(define-special-property content (&rest content)
(labels ((translate (content)
(typecase content
(string
;; Backwards compat with the usage of "'foo'" in LASS files
(when (and (<= 2 (length content))
(char= #\' (char content 0))
(char= #\' (char content (1- (length content)))))
(setf content (subseq content 1 (1- (length content)))))
(list (make-property "content"
(with-output-to-string (out)
(write-char #\" out)
(unwind-protect
@ -159,9 +159,10 @@
do (when (char= char #\")
(write-char #\\ out))
(write-char char out))
(write-char #\" out))))))
(write-char #\" out))))
(T
(list (make-property "content" (resolve content))))))
(resolve content)))))
(list (make-property "content" (format NIL "~{~a~^ ~}" (mapcar #'translate content))))))
(defmacro define-browser-property (name args &body browser-options)
"Helper macro to define properties that have browser-dependant versions.