Skip to content

Commit

Permalink
Check if escaped string is empty in HTML method
Browse files Browse the repository at this point in the history
Fixes #104.
  • Loading branch information
ruricolist committed Dec 12, 2024
1 parent 2c70f31 commit a57b54a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion run.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions tests.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -850,3 +850,7 @@ bar</pre>"
(spinneret:with-html-string
(:span "Click the " (:a :href "https://google.com" ) "."))
"<span>Click the <a href=\"https://google.com\"></a>.</span>")))

(test html-tag-empty-string
(finishes
(spinneret:with-html-string (:style ""))))

0 comments on commit a57b54a

Please sign in to comment.