summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2021-07-03 17:07:06 +0200
committerDavid Thompson <dthompson@vistahigherlearning.com>2021-07-14 15:34:39 -0400
commit8eb0ee17b5b57893eefb3683a37ccb4783b13473 (patch)
treebdde9a2048897a9cd1dd4391c6c78ea80317a193
parent51727cbb7fc05ef743aab2d7b16314ea1ed790e4 (diff)
sxml: Allow multiple classes.
* syntax-highlight.scm (highlights->sxml): Allow multiple tags in syntax elements.
-rw-r--r--syntax-highlight.scm10
1 files changed, 8 insertions, 2 deletions
diff --git a/syntax-highlight.scm b/syntax-highlight.scm
index 4326a4c..265ff37 100644
--- a/syntax-highlight.scm
+++ b/syntax-highlight.scm
@@ -61,6 +61,12 @@ corresponding to the highlighting tag name."
(map (match-lambda
((? string? str) str)
- ((tag text)
- `(span (@ (class ,(tag->class tag))) ,text)))
+ ((content ...)
+ (let loop ((tags '()) (text "") (content content))
+ (match content
+ (() `(span (@ (class ,(string-join (map tag->class tags) " "))) ,text))
+ (((? symbol? tag) content ...)
+ (loop (cons tag tags) text content))
+ (((? string? s) content ...)
+ (loop tags (string-append text s) content))))))
highlights))