diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-08-06 02:37:36 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2022-08-06 02:37:36 -0300 |
commit | ef42aa8681ac2cab218c9911afc894e5c0debb91 (patch) | |
tree | 7fae1e36fcaaeee7bec85c607347607c8618eade | |
parent | 59397bc47d3ebabbc589b04ef99d1a2a3fbc8f2d (diff) | |
download | shtml-ef42aa8681ac2cab218c9911afc894e5c0debb91.tar.gz shtml-ef42aa8681ac2cab218c9911afc894e5c0debb91.zip |
Eval downcase-name at compile time
-rw-r--r-- | shtml.lisp | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -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 |