aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2023-08-28 14:14:59 +0100
committerArun Isaac2023-08-29 17:08:46 +0100
commit69e107a3740e6b23de155404e67a9503309523d4 (patch)
tree64194f34e857b86b47bc5cf74c3d041e4c3fd287
parent33255a1dca0deeb5fed2966b03dc64658e8535b3 (diff)
downloadskribilo-69e107a3740e6b23de155404e67a9503309523d4.tar.gz
skribilo-69e107a3740e6b23de155404e67a9503309523d4.tar.lz
skribilo-69e107a3740e6b23de155404e67a9503309523d4.zip
html: Add CSS style declaration abstraction.
* src/guile/skribilo/engine/html.scm (style-declaration): New function.
-rw-r--r--src/guile/skribilo/engine/html.scm18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/guile/skribilo/engine/html.scm b/src/guile/skribilo/engine/html.scm
index 991050b..a04fb52 100644
--- a/src/guile/skribilo/engine/html.scm
+++ b/src/guile/skribilo/engine/html.scm
@@ -609,6 +609,24 @@ unspecified or #f values are ignored."
(newline))
;*---------------------------------------------------------------------*/
+;* style-declaration ... */
+;*---------------------------------------------------------------------*/
+(define (style-declaration properties)
+ "Return a style declaration with PROPERTIES, an association list
+mapping property names to their values. Property names may be symbols
+or strings. Values may be strings or numbers. Properties with #f
+values are ignored. If PROPERTIES is empty or all of its elements were
+ignored, return #f."
+ (match (filter-map (match-lambda
+ ((name . value)
+ (and value
+ (format #f "~a: ~a;" name value))))
+ properties)
+ (() #f)
+ (serialized-properties
+ (string-join serialized-properties))))
+
+;*---------------------------------------------------------------------*/
;* html-markup-class ... */
;*---------------------------------------------------------------------*/
(define (html-markup-class m)