Wrap user element functions with macro
This commit is contained in:
parent
169a0c1467
commit
3d8fad8e3f
1 changed files with 18 additions and 14 deletions
|
@ -149,7 +149,9 @@ When given :ASCII and :ATTR, it's possible to insert html text as a children, e.
|
||||||
(call-next-method))
|
(call-next-method))
|
||||||
|
|
||||||
(defmacro! define-element (name (&rest args) &body body)
|
(defmacro! define-element (name (&rest args) &body body)
|
||||||
`(defun ,name (&rest ,g!attrs-and-children)
|
(let ((%name (alexandria:symbolicate '% name)))
|
||||||
|
`(progn
|
||||||
|
(defun ,%name (&rest ,g!attrs-and-children)
|
||||||
(multiple-value-bind (,g!attrs ,g!children)
|
(multiple-value-bind (,g!attrs ,g!children)
|
||||||
(split-attrs-and-children ,g!attrs-and-children)
|
(split-attrs-and-children ,g!attrs-and-children)
|
||||||
(let ((,g!element
|
(let ((,g!element
|
||||||
|
@ -162,7 +164,9 @@ When given :ASCII and :ATTR, it's possible to insert html text as a children, e.
|
||||||
(list arg `(attr attrs (make-keyword ',arg))))
|
(list arg `(attr attrs (make-keyword ',arg))))
|
||||||
args)
|
args)
|
||||||
(progn ,@body))))
|
(progn ,@body))))
|
||||||
,g!element))))
|
,g!element)))
|
||||||
|
(defmacro ,name (&body attrs-and-children)
|
||||||
|
`(,',%name ,@attrs-and-children)))))
|
||||||
|
|
||||||
(defvar *expand-user-element* t)
|
(defvar *expand-user-element* t)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue