From 7d94d02f42af42acc9645927bd2135f122d80273 Mon Sep 17 00:00:00 2001 From: paku Date: Tue, 20 Feb 2024 11:09:38 +0900 Subject: [PATCH] Clarify keywords in loop macro --- src/elements.lisp | 14 +++++++------- src/escape.lisp | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/elements.lisp b/src/elements.lisp index eaff834..ab1270b 100644 --- a/src/elements.lisp +++ b/src/elements.lisp @@ -136,13 +136,13 @@ (values (make-attrs :alist (asu:hash-alist (first attrs-and-children))) (flatten (rest attrs-and-children)))) ((keywordp (first attrs-and-children)) ;inline-plist - (loop for thing on attrs-and-children by #'cddr - for (k v) = thing - when (and (keywordp k) v) - collect (cons k v) into attrs - when (not (keywordp k)) - return (values (make-attrs :alist attrs) (flatten thing)) - finally (return (values (make-attrs :alist attrs) nil)))) + (loop :for thing :on attrs-and-children :by #'cddr + :for (k v) := thing + :when (and (keywordp k) v) + :collect (cons k v) :into attrs + :when (not (keywordp k)) + :return (values (make-attrs :alist attrs) (flatten thing)) + :finally (return (values (make-attrs :alist attrs) nil)))) (t (values (make-attrs :alist nil) (flatten attrs-and-children))))) diff --git a/src/escape.lisp b/src/escape.lisp index 777f6a8..30ea371 100644 --- a/src/escape.lisp +++ b/src/escape.lisp @@ -25,15 +25,15 @@ (defun escape-char (char escape-map) (or (cdr (assoc char escape-map)) - char)) + char)) (defun escape-string (string escape-map) (if (stringp string) (with-output-to-string (s) (loop - for c across string - do (write (escape-char c escape-map) - :stream s :escape nil))) + :for c :across string + :do (write (escape-char c escape-map) + :stream s :escape nil))) string)) (defun escape-attrs-alist (alist)