Tidying up style, and switch to display in one spot
This commit is contained in:
parent
0eac888619
commit
c18669e7b5
1 changed files with 12 additions and 6 deletions
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
(define (style->sequence style port)
|
(define (style->sequence style port)
|
||||||
(define str (style-string style))
|
(define str (style-string style))
|
||||||
(define (just-str) (format port "~a" str))
|
(define (just-str) (display str port))
|
||||||
|
|
||||||
;; Color sequences aren't strings, so handle them specially
|
;; Color sequences aren't strings, so handle them specially
|
||||||
;; Colors don't get resolved until we have the port because we don't know the color profile until then.
|
;; Colors don't get resolved until we have the port because we don't know the color profile until then.
|
||||||
|
@ -72,12 +72,18 @@
|
||||||
|
|
||||||
(define (cons-seq stylish sequence)
|
(define (cons-seq stylish sequence)
|
||||||
(match stylish
|
(match stylish
|
||||||
((? string? str) (make-style str (list sequence)))
|
((? string? str)
|
||||||
((style) (cons-seq style sequence))
|
(make-style str (list sequence)))
|
||||||
((? list? l) (make-style-node (map (cut cons-seq <> sequence) l)))
|
((style)
|
||||||
((? style? style) (set-style-sequences style (cons* sequence (style-sequences style))))
|
(cons-seq style sequence))
|
||||||
|
((? list? l)
|
||||||
|
(make-style-node (map (cut cons-seq <> sequence) l)))
|
||||||
|
((? style? style)
|
||||||
|
(set-style-sequences style
|
||||||
|
(cons* sequence (style-sequences style))))
|
||||||
((? style-node? node)
|
((? style-node? node)
|
||||||
(set-style-node-children node (map (cut cons-seq <> sequence) (style-node-children node))))))
|
(set-style-node-children node
|
||||||
|
(map (cut cons-seq <> sequence) (style-node-children node))))))
|
||||||
|
|
||||||
(define (bold . s) (cons-seq s %BOLD))
|
(define (bold . s) (cons-seq s %BOLD))
|
||||||
(define (faint . s) (cons-seq s %FAINT))
|
(define (faint . s) (cons-seq s %FAINT))
|
||||||
|
|
Loading…
Reference in a new issue