From 0b1899fb38bb157daac91a5de3dd697489834f00 Mon Sep 17 00:00:00 2001 From: paku Date: Tue, 11 Jun 2024 19:18:47 +0900 Subject: [PATCH] Add docstrings --- src/element.lisp | 3 +++ src/hsx.lisp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/element.lisp b/src/element.lisp index 45b2861..ee6cf5d 100644 --- a/src/element.lisp +++ b/src/element.lisp @@ -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))) diff --git a/src/hsx.lisp b/src/hsx.lisp index a3e3d85..053b1ed 100644 --- a/src/hsx.lisp +++ b/src/hsx.lisp @@ -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) @@ -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))