change how attr-keys are printed

main
Matthew Butterick 3 years ago
parent 9e005433b0
commit 2cc67cd3bf

@ -53,6 +53,7 @@
(for/fold ([posn0 ($point 0 0)]
#:result qs)
([q (in-list qs)])
#RRR q
(define first-posn-on-next-line ($point 0 (add1 ($point-y posn0))))
(define other-possible-posns (list first-posn-on-next-line))
(define posn1 (for/first ([posn (in-list (cons posn0 other-possible-posns))]

@ -1,5 +1,6 @@
#lang racket/base
(require (for-syntax racket/base racket/syntax))
(require (for-syntax racket/base racket/syntax)
racket/struct)
(provide (all-defined-out))
(struct $drawing-inst () #:transparent)
@ -9,7 +10,10 @@
(struct $doc $drawing-inst (inst) #:transparent)
(struct $page $drawing-inst (inst) #:transparent)
(struct attr-key (name mandatory? default) #:transparent)
(struct attr-key (name mandatory? default) #:transparent
#:methods gen:custom-write
[(define (write-proc val out mode)
(fprintf out (format ":~a" (attr-key-name val))))])
(define (make-attr-key name [mandatory? #false] [default #false])
(attr-key name mandatory? default))

Loading…
Cancel
Save