diff options
author | Case Duckworth | 2023-05-31 17:24:20 -0500 |
---|---|---|
committer | Case Duckworth | 2023-05-31 17:24:20 -0500 |
commit | bb5353bc43d27008b3a1efd73b6fc0fce80a071b (patch) | |
tree | 12d2ffc2ae9bc74379385b88374d244615b7446f | |
parent | Delete spurious file (diff) | |
download | yolk-bb5353bc43d27008b3a1efd73b6fc0fce80a071b.tar.gz yolk-bb5353bc43d27008b3a1efd73b6fc0fce80a071b.zip |
Add (with-attrs)
-rw-r--r-- | readme | 4 | ||||
-rw-r--r-- | yolk.attrs.sld | 3 | ||||
-rw-r--r-- | yolk.attrs.ss | 6 |
3 files changed, 12 insertions, 1 deletions
diff --git a/readme b/readme index baa3bbc..4647c97 100644 --- a/readme +++ b/readme | |||
@@ -72,6 +72,10 @@ AS is a list of attributes, each of one of the following forms: | |||
72 | 72 | ||
73 | Anything else is an error. `attrs' returns a string ready to be displayed on the terminal. | 73 | Anything else is an error. `attrs' returns a string ready to be displayed on the terminal. |
74 | 74 | ||
75 | -- (with-attrs as str) | ||
76 | |||
77 | Print STR prepended with AS and followed by (attrs 'reset). | ||
78 | |||
75 | (yolk cursor) --- cursor movement | 79 | (yolk cursor) --- cursor movement |
76 | 80 | ||
77 | Variables. | 81 | Variables. |
diff --git a/yolk.attrs.sld b/yolk.attrs.sld index 07fd0ad..5502ee4 100644 --- a/yolk.attrs.sld +++ b/yolk.attrs.sld | |||
@@ -1,6 +1,7 @@ | |||
1 | (define-library (yolk attrs) | 1 | (define-library (yolk attrs) |
2 | (export prop? | 2 | (export prop? |
3 | color? | 3 | color? |
4 | attrs) | 4 | attrs |
5 | with-attrs) | ||
5 | 6 | ||
6 | (include "yolk.attrs.ss")) | 7 | (include "yolk.attrs.ss")) |
diff --git a/yolk.attrs.ss b/yolk.attrs.ss index 6a06034..2393905 100644 --- a/yolk.attrs.ss +++ b/yolk.attrs.ss | |||
@@ -85,3 +85,9 @@ | |||
85 | => (lambda (prop) | 85 | => (lambda (prop) |
86 | (cddr (assq prop %props-alist)))) | 86 | (cddr (assq prop %props-alist)))) |
87 | (else (error "Bad attribute" attr)))) | 87 | (else (error "Bad attribute" attr)))) |
88 | |||
89 | (define (with-attrs as str) | ||
90 | (string-append | ||
91 | (attrs as) | ||
92 | str | ||
93 | (attrs 'reset))) | ||