Fix content and add counter property function.
This commit is contained in:
parent
1a8f31d011
commit
580f474ebf
32
special.lisp
32
special.lisp
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue