From 1b2b7c3eb939724696894f31ff27db97b0cac84c Mon Sep 17 00:00:00 2001 From: Andreas Widen Date: Sat, 25 Nov 2023 17:21:37 +0100 Subject: Initial commit. Signed-off-by: Andreas Widen --- apps/aux/sxml.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 apps/aux/sxml.scm (limited to 'apps/aux/sxml.scm') diff --git a/apps/aux/sxml.scm b/apps/aux/sxml.scm new file mode 100644 index 0000000..531cdee --- /dev/null +++ b/apps/aux/sxml.scm @@ -0,0 +1,23 @@ +;;; Harmonic Flow web site + +(define-module (apps aux sxml) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:export (sxml->string*)) + + +(define (sxml->string* tree) + "Flatten tree by dismissing tags and attributes, and return the resulting +string." + (define (sxml->strings tree) + (match tree + (((? symbol?) ('@ _ ...) body ...) + (append-map sxml->strings `(" " ,@body " "))) + (((? symbol?) body ...) + (append-map sxml->strings `(" " ,@body " "))) + ((? string?) + (list tree)) + ((lst ...) + (sxml->strings `(div ,@lst))))) + + (string-concatenate (sxml->strings tree))) -- cgit v1.2.3-54-g00ecf