Add test for hsx/hsx package

This commit is contained in:
Akira Tempaku 2024-05-26 12:26:09 +09:00
commit 55cf69582f
4 changed files with 136 additions and 62 deletions

View file

@ -19,10 +19,13 @@
:initarg :children)))
(defun create-element (type props &rest children)
(make-instance 'element
:type type
:props props
:children (flatten children)))
(let ((elm (make-instance 'element
:type type
:props props
:children (flatten children))))
(prog1 elm
;dry-run to validate props
(expand elm))))
(defmethod expand ((elm element))
(with-accessors ((type element-type)
@ -34,8 +37,6 @@
(list :children children))))
elm)))
;;;; utils
(defun flatten (x)
(labels ((rec (x acc)
(cond ((null x) acc)

View file

@ -26,7 +26,7 @@
',props
,@children))))
(defmacro define-and-export-builtin-elements (&body names)
(defmacro define-and-export-builtin-elements (&rest names)
`(progn
,@(mapcan (lambda (name)
(list `(define-builtin-element ,name)
@ -34,7 +34,7 @@
names)))
(define-and-export-builtin-elements
a abbr address area article aside audio b base bdi bdo blockquote
a abbr address area article aside audio b base bdi bdo blockquote
body br button canvas caption cite code col colgroup data datalist
dd del details dfn dialog div dl dt em embed fieldset figcaption
figure footer form h1 h2 h3 h4 h5 h6 head header html hr i iframe