From 20ab54531205d94763f51753c1b02cc42685f4e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Sun, 7 Aug 2022 18:25:16 -0300 Subject: Add a way to concatenate tags with custom separators --- shtml.lisp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'shtml.lisp') diff --git a/shtml.lisp b/shtml.lisp index 1bb1463..b20ece7 100644 --- a/shtml.lisp +++ b/shtml.lisp @@ -1,5 +1,10 @@ (in-package #:shtml) +(defun cat (separator &rest lines) + (format nil + (concatenate 'string "~{~a~^" separator "~}") + lines)) + (defun trim-flatten-assoc (lst) (loop :for (i . j) :in lst :when j :append (list i j))) @@ -43,7 +48,7 @@ (mapcar (lambda (attr) (list 'cons (downcase-name attr) attr)) attrs)))) - `(defmacro ,tag (&rest ,args) + `(defmacro ,tag (&body ,args) (let ((body (gensym)) (parsed-args (separate-keys ,args))) `((lambda (,body &key ,@',attrs) @@ -61,7 +66,7 @@ (mapcar (lambda (attr) (list 'cons (downcase-name attr) attr)) attrs)))) - `(defmacro html (&rest ,args) + `(defmacro html (&body ,args) (let ((body (gensym)) (parsed-args (separate-keys ,args))) `((lambda (,body &key ,@',attrs) -- cgit v1.2.3