From 8eb0ee17b5b57893eefb3683a37ccb4783b13473 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sat, 3 Jul 2021 17:07:06 +0200 Subject: sxml: Allow multiple classes. * syntax-highlight.scm (highlights->sxml): Allow multiple tags in syntax elements. --- syntax-highlight.scm | 10 ++++++++-- 1 file 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)) -- cgit v1.2.3