From a57b54a0b373490456b8edbe0e0795743c1bbc23 Mon Sep 17 00:00:00 2001 From: "Paul M. Rodriguez" Date: Wed, 11 Dec 2024 21:57:28 -0600 Subject: [PATCH] Check if escaped string is empty in HTML method Fixes #104. --- run.lisp | 3 ++- tests.lisp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/run.lisp b/run.lisp index 4f05fdc..6b4608e 100644 --- a/run.lisp +++ b/run.lisp @@ -118,7 +118,8 @@ (let ((string (escaped-string-value string))) (when (or (string^= " " string) ;; Don't insert spaces before punctuation. - (not (alpha-char-p (alexandria:first-elt string)))) + (and (not (alexandria:emptyp string)) + (not (alpha-char-p (alexandria:first-elt string))))) (cancel-space))) (call-next-method) (values)) diff --git a/tests.lisp b/tests.lisp index 92040f3..176da3d 100644 --- a/tests.lisp +++ b/tests.lisp @@ -850,3 +850,7 @@ bar" (spinneret:with-html-string (:span "Click the " (:a :href "https://google.com" ) ".")) "Click the ."))) + +(test html-tag-empty-string + (finishes + (spinneret:with-html-string (:style ""))))