blob: 531cdeed77f0c958b61719aaa6c1c2e90532e13e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)))
|