Fix content and add counter property function.

This commit is contained in:
Shinmera 2018-03-09 16:39:55 +01:00
parent 1a8f31d011
commit 580f474ebf
1 changed files with 19 additions and 13 deletions

View File

@ -34,6 +34,8 @@
(write-string "calc" out)
(proc func))))
(define-simple-property-function counter (var))
;;; BLOCKS
(define-special-block charset (charset)
@ -137,19 +139,23 @@
(define-special-property content (content)
;; 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
(loop for char across content
do (when (char= char #\")
(write-char #\\ out))
(write-char char out))
(write-char #\" out))))))
(typecase content
(string
(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
(loop for char across content
do (when (char= char #\")
(write-char #\\ out))
(write-char char out))
(write-char #\" out))))))
(T
(list (make-property "content" (resolve content))))))
(defmacro define-browser-property (name args &body browser-options)
"Helper macro to define properties that have browser-dependant versions.