From ae7545d5ce27403c25bfc3cbddeec953a343c07f Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 14 Jul 2024 15:57:05 +0200 Subject: [PATCH] web/dom, util:to-string: minor improvements - now should also work for numbers and other types --- util.lisp | 6 +++--- web/dom.lisp | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/util.lisp b/util.lisp index b356d06..743e6f2 100644 --- a/util.lisp +++ b/util.lisp @@ -13,10 +13,10 @@ (defun flatten-str (s &key (with " ")) (str:join with (str:lines s))) -(defun to-string (k) +(defun to-string (k &key (sep " ")) (if (atom k) - (string-downcase k) - (str:join " " (mapcar #'string-downcase k)))) + (format nil "~(~a~)" k) + (str:join sep (mapcar #'(lambda (s) (format nil "~(~a~)" s)) k)))) (defun to-keyword (s) (intern (string-upcase s) :keyword)) diff --git a/web/dom.lisp b/web/dom.lisp index 20ca5e5..39ca696 100644 --- a/web/dom.lisp +++ b/web/dom.lisp @@ -18,9 +18,6 @@ ,@body (get-output-stream-string *output*))) -(defmacro text (s) - `(put-string (string ,s))) - (defmacro put-string (s) `(write-string ,s *output*)) @@ -59,6 +56,9 @@ (put-string tag) (put-char #\>)) +(defun text (s) + (put-string (string s))) + (defun newline () (put-char #\Newline))