Use cl-str instead

This commit is contained in:
Akira Tempaku 2024-10-04 08:44:27 +09:00
commit 7ce7751900
6 changed files with 26 additions and 34 deletions

View file

@ -1,10 +1,11 @@
(defpackage #:hsx/element
(:use #:cl)
(:import-from #:str
#:collapse-whitespaces)
(:import-from #:hsx/utils
#:defgroup
#:escape-html-attribute
#:escape-html-text-content
#:minify)
#:escape-html-text-content)
(:export #:element
#:tag
#:html-tag
@ -126,7 +127,7 @@
(string-downcase (element-type element)))
(defmethod render-props ((element tag))
(minify
(collapse-whitespaces
(with-output-to-string (stream)
(loop
:for (key value) :on (element-props element) :by #'cddr

View file

@ -6,7 +6,6 @@
#:symbolicate)
(:export #:escape-html-attribute
#:escape-html-text-content
#:minify
#:defgroup))
(in-package #:hsx/utils)
@ -43,23 +42,6 @@
(defun escape-html-attribute (str)
(escape-string str *attribute-escape-map*))
(defun minify (str)
(with-output-to-string (out)
(let ((previous-space-p nil))
(loop
:for char :across str
:do (cond
((whitespace-p char)
(unless previous-space-p
(write-char #\Space out))
(setf previous-space-p t))
(t
(write-char char out)
(setf previous-space-p nil)))))))
(defun whitespace-p (char)
(member char '(#\Space #\Newline #\Tab #\Return) :test #'char=))
(defun make-keyword-hash-table (symbols)
(let ((ht (make-hash-table)))
(mapcar (lambda (sym)