From 69e107a3740e6b23de155404e67a9503309523d4 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 28 Aug 2023 14:14:59 +0100 Subject: html: Add CSS style declaration abstraction. * src/guile/skribilo/engine/html.scm (style-declaration): New function. --- src/guile/skribilo/engine/html.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') 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 @@ -608,6 +608,24 @@ unspecified or #f values are ignored." (display ">") (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 ... */ ;*---------------------------------------------------------------------*/ -- cgit v1.2.3