Add docstrings

This commit is contained in:
paku 2024-06-11 19:18:47 +09:00
parent 9745dc6788
commit 0b1899fb38
2 changed files with 7 additions and 0 deletions

View file

@ -72,6 +72,9 @@
;;;; methods ;;;; methods
(defgeneric render-to-string (element &key pretty)
(:documentation "Render an HSX element to a string."))
(defmethod render-to-string ((element element) &key pretty) (defmethod render-to-string ((element element) &key pretty)
(with-output-to-string (stream) (with-output-to-string (stream)
(write element :stream stream :pretty pretty))) (write element :stream stream :pretty pretty)))

View file

@ -13,6 +13,7 @@
;;;; hsx macro ;;;; hsx macro
(defmacro hsx (form) (defmacro hsx (form)
"Detect built-in HSX elements and automatically import them."
(find-builtin-symbols form)) (find-builtin-symbols form))
(defun find-builtin-symbols (node) (defun find-builtin-symbols (node)
@ -58,6 +59,9 @@
(defhsx ,name ,(make-keyword name)))) (defhsx ,name ,(make-keyword name))))
(defmacro defcomp (name props &body body) (defmacro defcomp (name props &body body)
"Define a function component for use in HSX.
The props must be declared with either &key or &rest (or both).
The body must return an HSX element."
(unless (or (null props) (unless (or (null props)
(member '&key props) (member '&key props)
(member '&rest props)) (member '&rest props))