From bb5353bc43d27008b3a1efd73b6fc0fce80a071b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 31 May 2023 17:24:20 -0500 Subject: Add (with-attrs) --- readme | 4 ++++ yolk.attrs.sld | 3 ++- yolk.attrs.ss | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) 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: Anything else is an error. `attrs' returns a string ready to be displayed on the terminal. +-- (with-attrs as str) + +Print STR prepended with AS and followed by (attrs 'reset). + (yolk cursor) --- cursor movement 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 @@ (define-library (yolk attrs) (export prop? color? - attrs) + attrs + with-attrs) (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 @@ => (lambda (prop) (cddr (assq prop %props-alist)))) (else (error "Bad attribute" attr)))) + +(define (with-attrs as str) + (string-append + (attrs as) + str + (attrs 'reset))) -- cgit 1.4.1-21-gabe81