Skip to content

Commit

Permalink
Add docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
skyizwhite committed Jun 11, 2024
1 parent 9745dc6 commit 0b1899f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/element.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@

;;;; methods

(defgeneric render-to-string (element &key pretty)
(:documentation "Render an HSX element to a string."))

(defmethod render-to-string ((element element) &key pretty)
(with-output-to-string (stream)
(write element :stream stream :pretty pretty)))
Expand Down
4 changes: 4 additions & 0 deletions src/hsx.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
;;;; hsx macro

(defmacro hsx (form)
"Detect built-in HSX elements and automatically import them."
(find-builtin-symbols form))

(defun find-builtin-symbols (node)
Expand Down Expand Up @@ -58,6 +59,9 @@
(defhsx ,name ,(make-keyword name))))

(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)
(member '&key props)
(member '&rest props))
Expand Down

0 comments on commit 0b1899f

Please sign in to comment.