Improve define-element
This commit is contained in:
parent
40df277aac
commit
1b617f7539
1 changed files with 23 additions and 21 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue