|
|
|
@ -114,6 +114,21 @@
|
|
|
|
|
(or (string->number av)
|
|
|
|
|
(raise-argument-error 'convert-numeric-attr-values "numeric string" av)))))
|
|
|
|
|
|
|
|
|
|
(define-pass (convert-set-attr-values qs)
|
|
|
|
|
#:pre (list-of quad?)
|
|
|
|
|
#:post (list-of quad?)
|
|
|
|
|
(do-attr-iteration qs
|
|
|
|
|
#:which-attr attr-set-key?
|
|
|
|
|
#:attr-proc (λ (ak av attrs)
|
|
|
|
|
(apply seteq (map string->symbol (string-split av))))))
|
|
|
|
|
|
|
|
|
|
(module+ test
|
|
|
|
|
(let ([q (convert-set-attr-values (upgrade-attr-keys (bootstrap-input '(div ((font-features "calt")(font-features-add "")(font-features-subtract "swsh liga"))))))])
|
|
|
|
|
(check-equal? (quad-ref q :font-features) (seteq 'calt))
|
|
|
|
|
(check-equal? (quad-ref q :font-features-add) (seteq))
|
|
|
|
|
(check-equal? (quad-ref q :font-features-subtract) (seteq 'swsh 'liga))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-pass (complete-attr-paths qs)
|
|
|
|
|
#:pre (list-of quad?)
|
|
|
|
|
#:post (list-of quad?)
|
|
|
|
@ -124,6 +139,7 @@
|
|
|
|
|
#:which-attr attr-path-key?
|
|
|
|
|
#:attr-proc (λ (ak av attrs) (path->complete-path av))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-pass (parse-dimension-strings qs)
|
|
|
|
|
#:pre (list-of quad?)
|
|
|
|
|
#:post (list-of quad?)
|
|
|
|
@ -139,18 +155,18 @@
|
|
|
|
|
[:foo (make-attr-cased-string-key 'foo)]
|
|
|
|
|
[:ps (make-attr-path-key 'ps)]
|
|
|
|
|
[:dim (make-attr-dimension-string-key 'dim)]
|
|
|
|
|
[:boolt (make-attr-boolean-key 'bool)]
|
|
|
|
|
[:boolf (make-attr-boolean-key 'bool)]
|
|
|
|
|
[:boolt (make-attr-boolean-key 'boolt)]
|
|
|
|
|
[:boolf (make-attr-boolean-key 'boolf)]
|
|
|
|
|
[:num (make-attr-numeric-key 'num)]
|
|
|
|
|
[:num-def-42 (make-attr-numeric-key 'num-def-42 #true 42)])
|
|
|
|
|
(parameterize ([current-attrs debug-attrs])
|
|
|
|
|
(define (make-q) (make-quad #:attrs (make-hasheq (list (cons :foo "BAR")
|
|
|
|
|
(cons 'ding "dong")
|
|
|
|
|
(cons :ps "file.txt")
|
|
|
|
|
(cons :dim "2in")
|
|
|
|
|
(cons :boolt "true")
|
|
|
|
|
(cons :boolf "false")
|
|
|
|
|
(cons :num "42.5")))))
|
|
|
|
|
(define (make-q) (make-quad #:attrs (list :foo "BAR"
|
|
|
|
|
'ding "dong"
|
|
|
|
|
:ps "file.txt"
|
|
|
|
|
:dim "2in"
|
|
|
|
|
:boolt "true"
|
|
|
|
|
:boolf "false"
|
|
|
|
|
:num "42.5")))
|
|
|
|
|
(define qs (list (make-q)))
|
|
|
|
|
(check-exn exn? (λ ()
|
|
|
|
|
(parameterize ([current-strict-attrs? #true])
|
|
|
|
|