summaryrefslogtreecommitdiff
path: root/shtml.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2022-08-06 02:37:36 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2022-08-06 02:37:36 -0300
commitef42aa8681ac2cab218c9911afc894e5c0debb91 (patch)
tree7fae1e36fcaaeee7bec85c607347607c8618eade /shtml.lisp
parent59397bc47d3ebabbc589b04ef99d1a2a3fbc8f2d (diff)
downloadshtml-ef42aa8681ac2cab218c9911afc894e5c0debb91.tar.gz
shtml-ef42aa8681ac2cab218c9911afc894e5c0debb91.zip
Eval downcase-name at compile time
Diffstat (limited to 'shtml.lisp')
-rw-r--r--shtml.lisp16
1 files changed, 9 insertions, 7 deletions
diff --git a/shtml.lisp b/shtml.lisp
index 8f5d7f0..ac72d2c 100644
--- a/shtml.lisp
+++ b/shtml.lisp
@@ -4,8 +4,10 @@
(loop :for (i . j) :in lst
:when j :append (list i j)))
-(defun downcase-name (s)
- (string-downcase (symbol-name s)))
+(eval-when
+ (:compile-toplevel)
+ (defun downcase-name (s)
+ (string-downcase (symbol-name s))))
(defun separate-keys (lst)
(let (keys body)
@@ -31,11 +33,11 @@
(let ((body (gensym))
(parsed-args (separate-keys ,args)))
`((lambda (,body &key ,@',attrs)
- (format nil "<~a~{ ~a=~s~}>~{~a~^ ~}</~a>"
- ,,tag-name
- (trim-flatten-assoc ,',attrs-and-values)
- ,body
- ,,tag-name)) ,@parsed-args)))
+ (format nil "<~a~{ ~a=~s~}>~{~a~^ ~}</~a>"
+ ,,tag-name
+ (trim-flatten-assoc ,',attrs-and-values)
+ ,body
+ ,,tag-name)) ,@parsed-args)))
`(defun ,tag (&key ,@attrs)
(format nil "<~a ~{~a=~s~^ ~}>"
,tag-name