Wrap html element function with macro

This commit is contained in:
paku 2024-02-04 00:46:53 +09:00
parent 3d8fad8e3f
commit 3815dd36b5

View file

@ -75,12 +75,16 @@ When given :ASCII and :ATTR, it's possible to insert html text as a children, e.
(defvar *builtin-elements* (make-hash-table)) (defvar *builtin-elements* (make-hash-table))
(defun html (&rest attrs-and-children) (defun %html (&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)
(make-builtin-element-with-prefix :tag "html" :attrs attrs (make-builtin-element-with-prefix :tag "html" :attrs attrs
:children children :children children
:prefix "<!DOCTYPE html>"))) :prefix "<!DOCTYPE html>")))
(defmacro html (&body attrs-and-children)
`(%html ,@attrs-and-children))
(setf (gethash :html *builtin-elements*) t) (setf (gethash :html *builtin-elements*) t)
(defmacro define-builtin-element (element-name) (defmacro define-builtin-element (element-name)