Improve define-element

This commit is contained in:
paku 2024-02-14 00:11:48 +09:00
parent 40df277aac
commit 1b617f7539

View file

@ -192,9 +192,11 @@
thead |time| title tr track u ul var video wbr) thead |time| title tr track u ul var video wbr)
(defmacro define-element (name (&rest args) &body body) (defmacro define-element (name (&rest args) &body body)
(alx:with-gensyms (attrs children exp-children) (let ((%name (alx:symbolicate '% name))
(let ((%name (alx:symbolicate '% name))) (attrs (gensym "attrs"))
`(progn (children (gensym "children"))
(exp-children (gensym "exp-children")))
`(eval-when (:compile-toplevel :load-toplevel :execute)
(defun ,%name (&rest attrs-and-children) (defun ,%name (&rest attrs-and-children)
(multiple-value-bind (,attrs ,children) (multiple-value-bind (,attrs ,children)
(split-attrs-and-children attrs-and-children) (split-attrs-and-children attrs-and-children)
@ -212,7 +214,7 @@
args) args)
(progn ,@body))))))) (progn ,@body)))))))
(defmacro ,name (&body attrs-and-children) (defmacro ,name (&body attrs-and-children)
`(,',%name ,@attrs-and-children)))))) `(,',%name ,@attrs-and-children)))))
(defun %<> (&rest attrs-and-children) (defun %<> (&rest attrs-and-children)
(multiple-value-bind (attrs children) (multiple-value-bind (attrs children)