From 3f3bd3392be3768c1d65d5a5edfd0f42178f851b Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 7 Nov 2024 06:27:01 -0800 Subject: elem builder functions accept lists --- src/hypnotisml.lisp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/hypnotisml.lisp b/src/hypnotisml.lisp index 846e30f..b681f30 100644 --- a/src/hypnotisml.lisp +++ b/src/hypnotisml.lisp @@ -365,13 +365,14 @@ ENSURE-NODE." STYLES is either null or a STYLES instance. ATTRIBS is either null or an ATTRIBS instance. CONTENTS is a list of NODE instances." - (when (<= 2 (count-if #'styles-p contents)) - (warn "There should be at most 1 STYLES instance in your elem contents.")) - (when (<= 2 (count-if #'attribs-p contents)) - (warn "There should be at most 1 ATTRIBS instance in your elem contents.")) - (values (find-if #'styles-p contents) - (find-if #'attribs-p contents) - (filter-nodes contents))) + (let ((contents (a:flatten contents))) + (when (<= 2 (count-if #'styles-p contents)) + (warn "There should be at most 1 STYLES instance in your elem contents.")) + (when (<= 2 (count-if #'attribs-p contents)) + (warn "There should be at most 1 ATTRIBS instance in your elem contents.")) + (values (find-if #'styles-p contents) + (find-if #'attribs-p contents) + (filter-nodes contents)))) (macrolet ((defelems (&body tags) (let ((children (gensym "children")) -- cgit v1.2.3