From 44906015a5f4b6a69624dce55305f02aa895d4d2 Mon Sep 17 00:00:00 2001 From: Cadence Ember Date: Mon, 5 Sep 2022 13:34:16 +1200 Subject: [PATCH] Fix (& x) forms in update-tree --- src/xexpr-utils.rkt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/xexpr-utils.rkt b/src/xexpr-utils.rkt index 87f52fe..5b87d34 100644 --- a/src/xexpr-utils.rkt +++ b/src/xexpr-utils.rkt @@ -158,7 +158,8 @@ (define attributes (bits->attributes (cdr element))) (define contents (filter element-is-content? (cdr element))) ; provide elements and strings (if (or (equal? element-type '*DECL) - (equal? element-type '@)) + (equal? element-type '@) + (equal? element-type '&)) ; special element, do nothing element ; regular element, transform it @@ -169,6 +170,10 @@ (map (λ (content) (if (element-is-element? content) (loop content) content)) contents))])))) +(module+ test + ; check (& x) sequences are preserved + (check-equal? (update-tree (λ (e t a c) (list t a c)) '(body "Hey" (& nbsp) (a (@ (href "/"))))) + '(body "Hey" (& nbsp) (a (@ (href "/")))))) (define (has-class? name attributes) (and (member name (string-split (or (get-attribute 'class attributes) "") " ")) #t))